-
Notifications
You must be signed in to change notification settings - Fork 2.3k
OnlineDDL: add in-order-completion count to show outputs #18966
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
base: main
Are you sure you want to change the base?
OnlineDDL: add in-order-completion count to show outputs #18966
Conversation
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[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
|
Signed-off-by: Tim Vaillancourt <[email protected]>
|
📝 Documentation updates detected! New suggestion: Document new dependent_migrations field in OnlineDDL output |
I'm starting to think this should just be a integer field like Your thoughts are appreciated 🙇 |
|
Adding doc PR by promptless: vitessio/website#2032 |
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 have an issue with reviewMigrationDependencies() being called on every tick, which means the migration row will be updated at about every minute, or even more frequently.
Alternatively, we can choose to only update it at this section:
if strategySetting.IsInOrderCompletion() {
if len(pendingMigrationsUUIDs) > 0 && pendingMigrationsUUIDs[0] != onlineDDL.UUID {
// wait for earlier pending migrations to complete
return nil
}
}this means the field will only be populated once the migration is ready to complete, not before (and then, repeatedly so).
On top of that, we can populate the field once right upon submission, or right when the migration is about to start running.
I'd avoid the current recurring update.
|
Testing-wise, |
Signed-off-by: Tim Vaillancourt <[email protected]>
|
@shlomi-noach I've made some updates to the PR:
Upon testing everything is working as expected. Let me know how that looks! An open question: should we just use an integer of dependent migrations (less info/more compact) or keep the more-verbose CSV list 🤔? |
Signed-off-by: Tim Vaillancourt <[email protected]>
mattlord
left a comment
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 think this will be a nice addition! We can't merge this, however, without any tests. I would like to see unit tests, I know there's no framework in place for it but Claude is quite good for that kind of thing.
At the very least, we should add to the existing "in order completion" end to end tests to confirm that this is behaving as expected/correctly. I'm happy to help with that if you like.
|
After some more thought on this PR, I'm going to simplify the approach pretty significantly Because we know everything "ahead" of us is required to cut-over when I will also rename the field |
Signed-off-by: Tim Vaillancourt <[email protected]>
|
@Promptless please refresh the PR you created to consider commit: 580b714 |
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
|
The PR is now updated to just a count of migrations we will wait for in-order-completion, if any. It is refreshed each loop we are in "ready" state + waiting, when Also the count is updated when we discover we were waiting, but we are no longer waiting Outstanding:
|
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
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 the one comment/concern, which may just be due to my ignorance. 🙂 Otherwise it LGTM. Let me know what you think.
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'm on board with changing this to be an integer. Truly all it takes is to make a human realize "oh, this migration is not completing because there's this other migration that our migration is waiting for". Whether a UUID or an int is not that important.
How would you feel about the name prior_in_order_pending_count? I think it's more descriptive than postponed_in_order_completions.
Would you like some guidance with e2e testing?
| sm.VitessLivenessIndicator = row.AsInt64("vitess_liveness_indicator", 0) | ||
| sm.UserThrottleRatio = float32(row.AsFloat64("user_throttle_ratio", 0)) | ||
| sm.SpecialPlan = row.AsString("special_plan", "") | ||
| sm.PostponedByInOrderCompletions = row.AsUint64("postponed_by_in_order_completions", 0) |
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.
in schema_migrations.sql the column is named postponed_in_order_completions, which is incompatible with the name used here.
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
mattlord
left a comment
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 a more thorough review this time and it LGTM.
We still need endtoend test additions/updates. IMO it's not ready for review w/o that.
@mattlord / @shlomi-noach thanks. I've updated to a new column name and incorporated the PR suggestions Unfortunately that change has broken some logic in unobvious ways - the count is now always zero 🤔. Still digging into that problem, then I'll add an end-to-end test |
shlomi-noach
left a comment
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.
Minor change; I can't see why the latest two commits would break anything. Let's do the other way around: add a e2e validation in a few places, see what happens.
Co-authored-by: Shlomi Noach <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]>
Co-authored-by: Shlomi Noach <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Tim Vaillancourt <[email protected]>
Description
This PR adds a
postponed_by_in_order_completionsfield to SHOW-like outputs from OnlineDDL, to make it clear to users how many migrations must execute in order, before a given migration (if any)Originally I approached this improvement by simply adding a logline to the OnlineDDL executor, but I felt this was sub-optimal for these reasons:
vtctldclient OnlineDDL <db> showandshow vitess_migrations, which to me doesn't address the main concern - visibilityThis change raises a valid question: what if you have a LOT of dependent migrations? The✅dependent_migrationstext-field could grow quite large. If this is a concern perhaps we need a different approach, such as a count or just-a-bool, eg:dependent_migrations #oris_postponed_in_order 0/1(or something)Another valid question: could we add unit tests? Yes, however the existing code I'm modifying has no tests and my goal here was to make a small improvement. If we'd like to tackle implementing unit tests for the greater logic in this PR, that is possible 👍
cc @shlomi-noach for thoughts, as we originally discussed a simpler approach
show vitess_migrations like '<uuid>':TBD
vtctldclient OnlineDDL commerce show:TBD
Draft documentation PR: vitessio/website#2032
Related Issue(s)
--in-order-completionstatus in OnlineDDL outputs #18900Checklist
Deployment Notes
AI Disclosure