-
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
Online DDL: Fail a --in-order-completion migration, if a _prior_ migration within the same context is 'failed' or 'cancelled' #16071
Online DDL: Fail a --in-order-completion migration, if a _prior_ migration within the same context is 'failed' or 'cancelled' #16071
Conversation
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
…ly bail out when one migration fails. This last test will fail and a followup commit will implement the code Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
… cancelled/failed Signed-off-by: Shlomi Noach <[email protected]>
…n' query picks a failed or cancelled migration with a given migration context, and which comes before a given migration Signed-off-by: Shlomi Noach <[email protected]>
… the same context is 'failed' or 'cancelled'. Failing happens either at 'ready' state or at 'running' state Signed-off-by: Shlomi Noach <[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 #16071 +/- ##
==========================================
- Coverage 68.20% 68.20% -0.01%
==========================================
Files 1541 1541
Lines 197332 197369 +37
==========================================
+ Hits 134598 134619 +21
- Misses 62734 62750 +16 ☔ View full report in Codecov by Sentry. |
t.Run("drop multiple tables and views, in-order-completion", func(t *testing.T) { | ||
uuidList := testOnlineDDLStatement(t, createParams(sql, ddlStrategy+" --in-order-completion", "vtctl", "", "", true)) // skip wait | ||
vuuids = strings.Split(uuidList, "\n") | ||
assert.Equal(t, 4, len(vuuids)) |
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 you didn't already know, you can use assert.Len
too/instead.
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 did not know!
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
Signed-off-by: Shlomi Noach <[email protected]>
// We will fail an in-order migration if there's _prior_ migrations within the same migration-context | ||
// which have failed. | ||
if onlineDDL.StrategySetting().IsInOrderCompletion() { | ||
wasFailed, err := e.validateInOrderMigration(ctx, onlineDDL) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if wasFailed { | ||
continue | ||
} | ||
} |
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.
Most of this function is just an extract/refactor out of runNextMigration()
and into an independent function of its own. But these lines above are then also added to fail a migration before even running it, if the in-order terms are not met.
Description
Fixes #16070
Either at scheduling time, or when
running
, for a given--in-order-completion
migration, if we find another migration in the samemigration-context
that isfailed
orcancelled
, and that other migration precedes our given migration chronologically (has a lowerid
value inschema_migrations
table), then we fail our given migration.Basically the idea is: if 5 migrations are meant to run in-order, and 3rd migration happens to fail, then 4th and 5th migrations should fail as well and should not be allowed to complete. If they were allowed to complete, they'd run out of order.
Related Issue(s)
#16070
Checklist
Deployment Notes