-
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
ApplySchema
: reroute ALTER VITESS_MIGRATION ... THROTTLE ...
via UpdateThrottlerConfig
#16030
ApplySchema
: reroute ALTER VITESS_MIGRATION ... THROTTLE ...
via UpdateThrottlerConfig
#16030
Conversation
…ed in topo. Initially this is not the case and the test should fail Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…TTLE' command Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
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
|
ApplySchema
: reroute ALTER VITESS_MIGRATION ... THROTTLE ...
via UpdateThrottlerConfig
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16030 +/- ##
==========================================
- Coverage 68.23% 68.23% -0.01%
==========================================
Files 1541 1541
Lines 197115 197223 +108
==========================================
+ Hits 134503 134574 +71
- Misses 62612 62649 +37 ☔ View full report in Codecov by Sentry. |
assert.Equal(t, throttlerapp.OnlineDDLName.String(), appRule.Name) | ||
assert.EqualValues(t, 1.0, appRule.Ratio) | ||
}) | ||
t.Run("unthrottling via ApplySchema", func(t *testing.T) { |
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 going to test the unthrottling as well, then IMO it makes sense to validate the keyspace config afterwards too.
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.
Done.
// We have already locked the keyspace | ||
ki, err := exec.ts.GetKeyspace(ctx, req.Keyspace) | ||
if err != nil { | ||
return err | ||
} |
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.
Where do we do that (lock the keyspace) in this call path? We lock it in vtgate before sending the query down to the vttablet? In this PR it looks like the vttablet parses the incoming query in the query service and then calls this function.
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 do lock it in vtgate, then that lock info should be attached to the context we get and we can use CheckKeyspaceLocked
to be sure we have locked it:
if err = topo.CheckKeyspaceLocked(ctx, req.Keyspace); err != nil {
return err
}
That would protect us in the case that somehow the locks lease expired or someone executed this directly against a tablet using one of the Execute
RPCs.
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.
Ah, we're already doing just that here: https://github.com/planetscale/vitess/blob/0d8ca1be54ec50feda41b75e750619df15c5b747/go/vt/topo/srv_keyspace.go#L397-L401
So the safety aspect is already addressed. From there it's only my curiosity. 🙂
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.
@mattlord it's locked here:
vitess/go/vt/schemamanager/tablet_executor.go
Line 302 in ab6c7af
ctx, unlock, lockErr := exec.ts.LockKeyspace(ctx, exec.keyspace, "ApplySchemaKeyspace") |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Description
Fixes #16029, this PR implements
UpdateThrottlerConfig
forALTER VITESS_MIGRATION ... THROTTLE|UNTHROTTLE
commands inApplySchema
.Related Issue(s)
ApplySchema
command should rerouteALTER VITESS_MIGRATION ... THROTTLE ...
viaUpdateThrottlerConfig
#16029v20.0.0-RC1
#16010Checklist
Deployment Notes