-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
VStream: Allow for automatic resume after Reshard across VStreams #15395
VStream: Allow for automatic resume after Reshard across VStreams #15395
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
1d284dc
to
e5d3048
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15395 +/- ##
==========================================
+ Coverage 65.65% 65.69% +0.03%
==========================================
Files 1563 1564 +1
Lines 194423 194623 +200
==========================================
+ Hits 127658 127863 +205
+ Misses 66765 66760 -5 ☔ View full report in Codecov by Sentry. |
b5b7974
to
dc80682
Compare
Signed-off-by: Matt Lord <[email protected]>
dc80682
to
d967187
Compare
Signed-off-by: Matt Lord <[email protected]>
a501e62
to
623cfdb
Compare
Signed-off-by: Matt Lord <[email protected]>
623cfdb
to
77894d7
Compare
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
775ee87
to
3ed17b0
Compare
Signed-off-by: Matt Lord <[email protected]>
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.
Looks good.
Signed-off-by: Matt Lord <[email protected]>
…d_resume Signed-off-by: Matt Lord <[email protected]>
go/vt/vtgate/vstream_manager.go
Outdated
// Now that we know there MAY have been an applicable reshard, let's make a | ||
// definitive determination by looking at the shard keyranges. | ||
for _, i := range shards { | ||
for _, j := range shards { | ||
if i.ShardName() == j.ShardName() && key.KeyRangeEqual(i.GetKeyRange(), j.GetKeyRange()) { | ||
// It's the same shard so skip it. | ||
continue | ||
} | ||
if key.KeyRangeIntersect(i.GetKeyRange(), j.GetKeyRange()) { | ||
// We have different shards with overlapping keyranges so we know | ||
// that a reshard has happened. | ||
return true, nil | ||
} | ||
} | ||
} |
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.
Overall, LGTM. If it ever becomes a concern, then we can improve the performance of this code by sorting the two lists of shards and then reading from both simultaneously once.
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.
It's a single map of shards. It's all of the shards in the keyspace, so e.g. if a keyspace is being sharded for the first time the list could be:
-
-80
80-
In that case we would take the first one, then compare it with -80 and see that they have overlapping key ranges.
Signed-off-by: Matt Lord <[email protected]>
Description
When we can see that a keyspace has been resharded — meaning that the keyspace has serving shards that differ from the ones provided in the current
VStream
RPC call, which are from the previousVStream
client connection — then we include non-serving tablets in our tablet picker so that we can select the tablets from the old / now-non-serving shards in the keyspace in order to ensure that we stream all remaining GTIDs needed from those shards between what we had last streamed and when theReshard
cutover (SwitchTraffic
orReverseTraffic
) took place, along with theReshard
journal event which allows us to then automatically and seamlessly start replicating from the beginning of time on the new shards.The remaining limitation, which there is no way around, is that the old shards cannot be deleted in between the VStreams — as we need to connect to those to ensure we stream all of the GTIDs created there before transitioning to the new shards.
Click here for a manual test in this branch:
Example final output:
Related Issue(s)
Checklist