-
Notifications
You must be signed in to change notification settings - Fork 676
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
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not include learner replica
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
@hicqu Please specify all the affected document versions. If the change in this PR also applies to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: qupeng <qupeng@pingcap.com>
cherry pick to release-4.0 in PR #2283 |
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)
What is the related PR or file link(s)?
pingcap/tidb#15721