Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: --in-order-completion ddl strategy and logic #12113
Online DDL: --in-order-completion ddl strategy and logic #12113
Changes from 9 commits
fbfdb9c
d316afa
2d95b53
06fee67
5fa5f79
43e0927
7f564da
446e542
dfb91a8
d5ab89d
4ccdba4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
AFAICT, this doesn't necessarily confirm that they occurred in submission order. Are we storing microsecond precision values in MySQL? If not, then this will likely only confirm that they (most often) happened within the same second. A potential alternative would be to look at the
performance_schema.events_statements_history
table (which uses picosecond precision for the timers) or what may be even more authoritative is looking at theshow binlog events
output to confirm commit order. For example:I'm not sure how strict this ordering is supposed to be and how much time and effort we then want to put into testing/confirming that.
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.
The onlineDDL scheduler is incapable of completing two migrations within the same second. The comparison is fair.
UUIDs are in submission order. Therefore
vuuids[0]
refer to the UUID of the first migration,vuuids[1]
is the UUID of the 2nd migration, etc.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.
OK.
The onlineDDL scheduler is incapable of completing two migrations within the same second
isn't something I'd seen/noticed before. I also don't see it here (unless I'm blind): https://github.com/vitessio/vitess/blob/main/doc/design-docs/OnlineDDLScheduler.mdSo if that behavior is assumed/required for this feature to work reliably then IMO we should at least comment that somewhere. Maybe we already have?
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.
You know, with apologies let me retract that comment. It is true, but irrelevant and confusing. The test
testTableCompletionTimes
merely checks that timestamp1 <= timestamp2; whether there's a full second between them or not, is irrelevant and not tested.With that, I understand the question; given that
completed_timestamp
is in 1second resolution, how do we validate that the two migrations did, in fact, complete in a specific order? Let me look into that and hopefully I can refine the tests!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
completed_timestamp
is nowtimestamp(6)
, and with that I think the comparison is now safe.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.
Don't we also want this for the vitess strategy?
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.
vitess
==online
. They are synonyms with the intention of only usingvitess
. But changing names is hard.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.
Should we update the pending migrations to say that the migration
onlineDDL.UUID
is no longer in a pending state?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 happens a few lines below,
So, it's only when the migration is actually started, or executed, that it leaves the pending migrations. There can always be a failure in between, and we don't want to lose track of the migration. This is why we rely on the
migration_status
persisted in_vt.schema_migrations
.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.
Got it, makes sense. Thanks!