-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Add follower read support to TiDB #11347
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
11f6f5e
Initial effort to add follower read to TiDB
sunxiaoguang ef3a32b
Add tests for replica read
sunxiaoguang 8beffef
Merge branch 'master' into replica_read
sunxiaoguang 013e0ca
Updated kvproto dependency and fixed a test
sunxiaoguang 7277838
Add more tests
sunxiaoguang 31f1333
Merge branch 'master' of https://github.com/pingcap/tidb into replica…
sunxiaoguang c43f94b
Merge branch 'master' into replica_read
sunxiaoguang 315aa95
Update kvproto
sunxiaoguang 7bb7d76
Run go mod tidy
sunxiaoguang 3c3f2e0
Merge branch 'master' into replica_read
sunxiaoguang f4d59d6
Merge branch 'master' into replica_read
sunxiaoguang 237005e
Refactor interface between SQL and KV layers
sunxiaoguang 136d760
Do not store index of followers in region cache
sunxiaoguang 93c88d4
Use session scope coprocessor client
sunxiaoguang 03c9576
Merge branch 'master' into replica_read
sunxiaoguang 3968c6b
Try next follower if selected follower had failed
sunxiaoguang 3bcd5c8
Handle failed follower when reading from it
sunxiaoguang 1775d42
Merge branch 'master' into replica_read
sunxiaoguang 13065e8
Merge branch 'master' into replica_read
sunxiaoguang 39c9add
Merge branch 'master' into replica_read
coocood d3b64ce
Merge branch 'master' of https://github.com/pingcap/tidb into replica…
sunxiaoguang b03c2d9
Merge branch 'master' into replica_read
sunxiaoguang 682333a
Assign different replica read seeds to snapshots
sunxiaoguang b0bf2a3
Merge branch 'master' into replica_read
sre-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,7 +268,7 @@ func (s *tikvStore) Begin() (kv.Transaction, error) { | |
|
||
// BeginWithStartTS begins a transaction with startTS. | ||
func (s *tikvStore) BeginWithStartTS(startTS uint64) (kv.Transaction, error) { | ||
txn, err := newTikvTxnWithStartTS(s, startTS) | ||
txn, err := newTikvTxnWithStartTS(s, startTS, s.nextReplicaReadSeed()) | ||
if err != nil { | ||
return nil, errors.Trace(err) | ||
} | ||
|
@@ -277,7 +277,7 @@ func (s *tikvStore) BeginWithStartTS(startTS uint64) (kv.Transaction, error) { | |
} | ||
|
||
func (s *tikvStore) GetSnapshot(ver kv.Version) (kv.Snapshot, error) { | ||
snapshot := newTiKVSnapshot(s, ver) | ||
snapshot := newTiKVSnapshot(s, ver, s.nextReplicaReadSeed()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
metrics.TiKVSnapshotCounter.Inc() | ||
return snapshot, nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this will make
ReadSeed
be changed for each txn in same session, it seem conflict to #11347 (comment)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.
Since it seems to be complicated to make it consistent over txn and coprocessor. And the whole discussion would be more efficient over instant messaging, therefore we had some discussion on WeChat group and agreed that we can use different policy for coprocessor and txn. Sorry for not giving out the context and clue about it here.