-
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
VReplication: Fix workflow update changed handling #15621
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
|
6f22505
to
2965e9c
Compare
This was inadvertently broken in vitessio#14447 Signed-off-by: Matt Lord <[email protected]>
2965e9c
to
8074898
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15621 +/- ##
==========================================
+ Coverage 68.03% 68.12% +0.09%
==========================================
Files 1561 1556 -5
Lines 195526 194984 -542
==========================================
- Hits 133023 132840 -183
+ Misses 62503 62144 -359 ☔ View full report in Codecov by Sentry. |
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
@@ -112,6 +112,7 @@ func commandUpdate(cmd *cobra.Command, args []string) error { | |||
TabletSelectionPreference: tsp, | |||
OnDdl: binlogdatapb.OnDDLAction(onddl), | |||
Shards: baseOptions.Shards, | |||
State: binlogdatapb.VReplicationWorkflowState(textutil.SimulatedNullInt), // We don't allow changing this in the client command |
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.
If we're not using the cli, is there documentation for when the zero value isn't sufficient for a no-op? Does it make sense to at least add field level comments to the proto?
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.
Good idea! I've added comments here: 3dd0e13
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.
That's helpful. Is it backwards compatible if we add optional
to those fields?
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 the go protobuf implementation everything is optional. And unfortunately it does not support the more recent optional
protobuf behavior where code is then injected to detect if a value was explicitly provided in the message. That's what the simulated NULL stuff is all about, because there's literally no way to determine if a value was actually provided or not (type's ZeroValue). I'm not terribly happy with it, but I could not find a less bad option today. I'd love to get rid of the simulated NULL whenever a better option appears.
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.
Sorry, my understanding is now dated! The go implementation DOES now support truly optional field behavior: https://github.com/protocolbuffers/protobuf/blob/v3.25.0/docs/field_presence.md
It does that by making the specified type, e.g. string, a pointer (*string). I'm looking into whether or not that's backward compatible now.
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.
#15627 ❤️
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.
Added a TODO in the comments as well to link everything together.
1. Add comments to the workflow update related proto messages 2. Remove/reserve an unused shards field in the WorkflowUpdateRequest msg 3. Add a wait to the mulit_tenant_test to address an obvserved flake Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
@@ -190,6 +190,7 @@ func TestMultiTenantSimple(t *testing.T) { | |||
for _, ks := range []string{sourceKeyspace, sourceAliasKeyspace} { | |||
lastIndex = insertRows(lastIndex, ks) | |||
} | |||
waitForWorkflowState(t, vc, fmt.Sprintf("%s.%s", targetKeyspace, mt.workflowName), binlogdatapb.VReplicationWorkflowState_Running.String()) |
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 unrelated, but addresses a test flake that was observed on the PR CI runs.
message UpdateVReplicationWorkflowRequest { | ||
string workflow = 1; | ||
repeated string cells = 2; | ||
repeated topodata.TabletType tablet_types = 3; | ||
TabletSelectionPreference tablet_selection_preference = 4; | ||
binlogdata.OnDDLAction on_ddl = 5; | ||
binlogdata.VReplicationWorkflowState state = 6; | ||
repeated string shards = 7; | ||
reserved 7; // unused, was: repeated string shards |
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 was errantly added in v19 and was missed during review. It caused no harm, but was entirely unnecessary/unused.
…5621) (#15629) Signed-off-by: Matt Lord <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Matt Lord <[email protected]>
…5621) (#15628) Signed-off-by: Matt Lord <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Matt Lord <[email protected]>
Description
The rows affected value in the
UpdateVReplicationWorkflow
tabletmanager RPC (see the PR changes) which is then turned into a booleanchanged
value in the correspondingUpdateWorkflow
vtctld RPC was inadvertently broken in: #14447This PR corrects that and also addresses an oversight in adding support for changing the State in the tabletmanager RPC (we should be passing the simulated NULL for the client command as we don't allow you to modify the state via the
workflow update
client command). Note that this had no real practical impact as the workflow is stopped and started as part of the update so the intermediate state ofUnknown
was extremely brief.Lastly, we close the testing gap here by confirming the changed value from the client command.
I wanted to backport this to v18 as it's a small and safe change and that's where these bugs were introduced.
Related Issue(s)
Checklist