-
Notifications
You must be signed in to change notification settings - Fork 2.3k
VReplication: Add reference-tables to existing materialize workflow #17804
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
VReplication: Add reference-tables to existing materialize workflow #17804
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
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17804 +/- ##
==========================================
- Coverage 67.54% 67.50% -0.05%
==========================================
Files 1601 1601
Lines 261484 261816 +332
==========================================
+ Hits 176612 176726 +114
- Misses 84872 85090 +218 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ed0f3e9 to
7d4356f
Compare
Signed-off-by: Noble Mittal <[email protected]>
7d4356f to
5b317c5
Compare
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
7b4c750 to
bdc7309
Compare
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
mattlord
left a 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.
This is looking really good! Please let me know what you think about my comments.
go/cmd/vtctldclient/command/vreplication/materialize/materialize.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
rohit-nayak-ps
left a 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.
lgtm!
I suggest we also update TestReferenceTableMaterialize to add another ref table to the workflow so we also test this in e2e.
…e-tables Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
|
@rohit-nayak-ps done. ptal at de2e068 |
shlomi-noach
left a 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.
I'm concerned about the wording here. The PR as well as the code label this as "materialization" but then again the same logic applies for MoveTables if I understand correctly. This will cause confusion down the line. Let's think about better terms that will apply to materialization, movetables, or any other type of workflow.
proto/vtctldata.proto
Outdated
| message MaterializeCreateResponse { | ||
| } | ||
|
|
||
| message MaterializeAddTablesRequest { |
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.
Will there likewise be a MoveTablesAddTablesRequest?
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.
noted, since this API works for both Materialize and MoveTables wfs, WorkflowAddTables seems like a better name imo.
| return err | ||
| } | ||
| vr.insertLog(LogCopyRestart, fmt.Sprintf("Copy phase restarted for %d table(s)", numTablesToCopy)) | ||
| } |
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.
Question: this change seems unrelated to this PR specifically, is that correct? Or is this PR creating the only scenario where this change is needed?
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.
Yeah, we need it here. When we are adding reference tables and inserting rows in _vt.copy_state, streams will jump back to Copying phase, this is when we need to log Copy phase restarted.
| } | ||
| return 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.
Question: say we run this on a multisharded cluster. One shard fails, we get an error, correct? What then happens if we attempt to add the table again on all shards? Will the shards that already know about the table accept the request silently or will they return an error?
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 looks like it will silently accept the request and insert another row in copy_state. Although I don't think it will cause any issues since vcopier will anyway look at the max(id) row from copy_state for a specific table and vrepl_id. Do you think we need any changes here? Not sure if we should delete the copy_state row in all other shards if it fails in one shard before we return error?
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'm not sure!
Signed-off-by: Noble Mittal <[email protected]>
|
@shlomi-noach thanks for the review. Please have a look at the comments. |
shlomi-noach
left a 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.
My one remaining question is about idempotency: what happens if you add a table that is already listed. Otherwise looks good.
Did you mean if we try to add a table that already has a filter rule? We have a check here that throws an error in that case: https://github.com/vitessio/vitess/pull/17804/files#diff-327b08a43697d540e06dfd4e4c4d0cb617dc66f9ad3d74c451b926405c9faae5R1017-R1023 |
Signed-off-by: Noble Mittal <[email protected]>
Description
This PR adds
WorkflowAddTablesinVtctldServer. This can be used to add tables to an existing VReplication MoveTables/Materialize workflow. It adds binlogsource rules in the existing workflow streams, and inserts the copy state row in_vt.copy_stateand restarts the workflow. Also adds aadd-reference-tablessub-command formaterializecommand, which can be used as following:Related Issue(s)
Checklist
Deployment Notes