-
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
Support for ALTER VITESS_MIGRATION statements #7663
Support for ALTER VITESS_MIGRATION statements #7663
Conversation
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…or RETRY alter type Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Documentation to follow |
This PR also refactors |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@systay points out that this PR has commits from merged PRs. It seems to be a rebase gone wrong. However, code-wise and diff-wise there doesn't seem to be a risk here. |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Confused about They're consistently failing after |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Kind request for review 🙏 (reminder: this PR extends #7656) |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
The old test had hardcoded values for the expected sizes of internal data structures. This makes for very brittle tests whenever we change the AST or introduce new query types. Instead of checking for the exact sizes of the data structures, check that they're being stored and whether they're larger than than an empty plan. Signed-off-by: Vicent Marti <vmg@strn.cat>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Sheesh. GitHub Actions is having another bad day. |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc" | ||
"vitess.io/vitess/go/vt/sqlparser" | ||
"vitess.io/vitess/go/vt/vterrors" | ||
"vitess.io/vitess/go/vt/vtgate/engine" | ||
) | ||
|
||
func buildRevertPlan(query string, stmt *sqlparser.RevertMigration, vschema ContextVSchema) (engine.Primitive, error) { | ||
func buildAlterMigrationPlan(query string, stmt *sqlparser.AlterMigration, vschema ContextVSchema) (engine.Primitive, 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.
nit: why ask for stmt
and then not 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.
Nice catch! Removed.
e.migrationMutex.Lock() | ||
defer e.migrationMutex.Unlock() | ||
parsed := sqlparser.BuildParsedQuery(sqlRetryMigration, ":tablet", whereExpr) | ||
parsed := sqlparser.BuildParsedQuery(sqlRetryMigrationWhere, ":tablet", whereExpr) |
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.
just noticed that three lines down, on line 2247, we are never checking err from parsed.GenerateQuery
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.
Fixed!
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…terface-alter Signed-off-by: Andres Taylor <andres@planetscale.com>
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!
Description
This PR introduces the following queries:
ALTER VITESS_MIGRATION '8c096d5e_81c0_11eb_a8d2_f875a4d24e90' RETRY
ALTER VITESS_MIGRATION '8c096d5e_81c0_11eb_a8d2_f875a4d24e90' CANCEL
ALTER VITESS_MIGRATION CANCEL ALL
The above map to these
vtctl
commands, respectively:vtctl OnlineDDL <keyspace> retry 8c096d5e_81c0_11eb_a8d2_f875a4d24e90
vtctl OnlineDDL <keyspace> cancel 8c096d5e_81c0_11eb_a8d2_f875a4d24e90
vtctl OnlineDDL <keyspace> cancel all
Also, reserved but not implemented yet:
ALTER VITESS_MIGRATION '8c096d5e_81c0_11eb_a8d2_f875a4d24e90' COMPLETE
Returned result set for these queries is always empty, but
AffectedRows
indicates how many migrations were actually affected by the command.The various
endtoend/onlineddl
tests now use these queries.Related Issue(s)
Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: