Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reference: add new option for tidb_replica_read #2252

Merged
merged 2 commits into from
Apr 15, 2020

Conversation

hicqu
Copy link
Contributor

@hicqu hicqu commented Apr 13, 2020

What is changed, added or deleted? (Required)

Add an new option for tidb_replica_read.

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

What is the related PR or file link(s)?

pingcap/tidb#15721

  • This PR is translated from:
  • Other reference link(s):

Signed-off-by: qupeng <qupeng@pingcap.com>
@@ -34,6 +34,7 @@ This variable is used to set the data read mode expected by the current session.

- When the value of `tidb_replica_read` is set to `leader` or an empty string, TiDB maintains its original behavior and sends all read operations to the leader replica to perform.
- When the value of `tidb_replica_read` is set to `follower`, TiDB selects a follower replica of the Region to perform all read operations.
- When the value of `tidb_replica_read` is set to `leader-and-follower`, TiDB can select any replicas to perform read operations.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not include learner replica

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Learners are included. In fact follower also includes them.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leader-and-follower also can read learner?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both leader-and-follower and follower can read learner.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about if a learner doesn't have enough data? For example, the replica is in balancing status.

Copy link
Contributor Author

@hicqu hicqu Apr 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's applying a snapshot, new proposals will be dropped and TiDB clients will switch to a next peer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we optimize it latter? For example, peer could report its status to pd, and TiDB will not choose the peer who is applying a snapshot (or not ready).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Seems it's possible.

@TomShawn TomShawn self-assigned this Apr 13, 2020
@TomShawn TomShawn added size/small Changes of a small size. translation/doing This PR's assignee is translating this PR. labels Apr 13, 2020
@TomShawn
Copy link
Contributor

TomShawn commented Apr 13, 2020

@hicqu Please specify all the affected document versions. If the change in this PR also applies to dev, please create another PR to make this change to dev, thanks!

Copy link

@zhangjinpeng87 zhangjinpeng87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hicqu hicqu merged commit b282ca8 into release-3.1 Apr 15, 2020
@hicqu hicqu deleted the 3.1-replica-new_option branch April 15, 2020 06:53
sre-bot pushed a commit to sre-bot/docs that referenced this pull request Apr 15, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Apr 15, 2020

cherry pick to release-4.0 in PR #2283

@TomShawn TomShawn changed the title follower read: add new option for tidb_replica_read reference: add new option for tidb_replica_read Apr 15, 2020
@TomShawn TomShawn added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR's assignee is translating this PR. labels Apr 15, 2020
TomShawn pushed a commit that referenced this pull request Apr 23, 2020
Signed-off-by: qupeng <qupeng@pingcap.com>

Co-authored-by: qupeng <qupeng@pingcap.com>
Co-authored-by: Shen Li <shenli3514@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/small Changes of a small size. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants