VStream: Allow for automatic resume after Reshard across VStreams#15395
VStream: Allow for automatic resume after Reshard across VStreams#15395mattlord merged 11 commits intovitessio:mainfrom
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 <mattalord@gmail.com>
dc80682 to
d967187
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
a501e62 to
623cfdb
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
775ee87 to
3ed17b0
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
…d_resume Signed-off-by: Matt Lord <mattalord@gmail.com>
| // 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.
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.
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 <mattalord@gmail.com>
…tessio#15395) Signed-off-by: twthorn <thomaswilliamthornton@gmail.com>
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
VStreamRPC call, which are from the previousVStreamclient 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 theReshardcutover (SwitchTrafficorReverseTraffic) took place, along with theReshardjournal 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