-
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
OnlineDDL: avoid schema_migrations AUTO_INCREMENT gaps by pre-checking for existing migration #12169
OnlineDDL: avoid schema_migrations AUTO_INCREMENT gaps by pre-checking for existing migration #12169
Conversation
…g for existing migration Signed-off-by: Shlomi Noach <[email protected]>
converted to draft, doing another necessary refactor (need to take singleron/singleton-context scenario into consideration) |
… logic applies both to migration submission as well as RetryMigration() Signed-off-by: Shlomi Noach <[email protected]>
OK, did another refactor; extracted an inner 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.
LGTM!
Not breaking any test would indicate that we probably don't have test coverage around submissions. 🙂 I think we should add more unit tests eventually (that could also e.g. confirm that we don't have gaps anymore when we resubmit) but that's a bigger issue and not specific to this work.
In the meantime, can we easily add anything to the endtoend tests to confirm the behavioral change? Perhaps a select at the end of a workflow to look for gaps in the migration IDs?
The opposite is true. We have plenty tests around submissions -- every single test, really, and in particular all |
I'll look into that. |
Yea, I meant code test coverage — i.e. unit tests. 🙂 Was just noting it (not a blocker). |
Signed-off-by: Shlomi Noach <[email protected]>
Added an explicit test to validate |
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
request for review from @vitessio/query-serving |
Description
Fixes #12168
This PR prevents excessive gaps in
_vt.schema_migrations
id
values with a small refactor:INSERT IGNORE
, we firstSELECT
for existing migration UUID, and only if it does not exist, weINSERT
.SubmitMigration
function and does not otherwise conflict with the rest of the scheduler's work)INSERT IGNORE
, which addresses the case where the UUID pre-existed, is now moved to run beforeINSERT IGNORE
Tests are unchanged. We expect no change in behavior.
Related Issue(s)
#12168
Checklist
Deployment Notes