-
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
Migrate Workflow: Scope vindex names correctly when target and source keyspace have different names #16769
Migrate Workflow: Scope vindex names correctly when target and source keyspace have different names #16769
Conversation
…names are different, we need to scope the vindex used in the vreplication filter to the local name Signed-off-by: Rohit Nayak <[email protected]>
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
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16769 +/- ##
==========================================
+ Coverage 68.98% 69.53% +0.54%
==========================================
Files 1562 1568 +6
Lines 200697 202442 +1745
==========================================
+ Hits 138459 140764 +2305
+ Misses 62238 61678 -560 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Rohit Nayak <[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.
In general it LGTM. I had some minor nits and suggestions, the only thing that I think we really should do is address the it is expected that the source and target keyspaces have the same vindex name and data type
part and confirm that ourselves. Unless there's some reason(s) that we cannot?
if mz.workflowType == binlogdatapb.VReplicationWorkflowType_Migrate { | ||
// For a Migrate, if the TargetKeyspace name is different from the SourceKeyspace name, we need to use the | ||
// SourceKeyspace name to determine the vindex since the TargetKeyspace name is not known to the source. | ||
// Note: it is expected that the source and target keyspaces have the same vindex name and data type. |
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.
I think that we should check and confirm this expectation and error out if it's not true.
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 is assumed that the vschemas and tables etc are identical on source and target for Migrate
. We can/should add all vaidations for this and all other workflow types in another PR. I don't want to add that to this PR.
// cluster with keyspace rating. | ||
func TestMigrateSharded(t *testing.T) { | ||
setSidecarDBName("_vt") | ||
defaultRdonly = 1 |
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.
Why set this? I don't see where we use it.
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 is that global variable that we have not refactored yet. It is used in creating future clusters in the test. Added code to keep previous values and reset in a defer.
Signed-off-by: Rohit Nayak <[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.
Nice work!
… keyspace have different names (#16769) Signed-off-by: Rohit Nayak <[email protected]>
…rget and source keyspace have different names (#16769) (#16815) Signed-off-by: Rohit Nayak <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Description
We use the target keyspace’s vindex for filtering out rows from the source intended for each target shard. The vindex is qualified by the target keyspace name. When the source cluster has a different name for the keyspace, it fails while trying to stream from the source cluster, because it cannot locate the vindex.
This PR sets the vindex scope to that of the source keyspace if the keyspace names differ. Note that it is assumed that the same vindexes are used on both keyspaces during a
Migrate
Related Issue(s)
#16777
Checklist
Deployment Notes