Repository navigation
fix(ci): Discard partial worker databases before the bootstrap fallback - #131652
Merged
Merged
Conversation
If copying default_gw0 to the other worker databases fails partway, the fallback ran snuba bootstrap on a half-restored database, whose partial migrations_local can make it skip migrations. A client timeout also left the RESTORE running on the server while the fallback started. Tag each RESTORE with a query_id, and in the fallback kill any that are still running, then drop every target database before bootstrapping it. Follow-up to #131172. Co-Authored-By: Joshua Li <[email protected]>
joshuarli
marked this pull request as ready for review
November 18, 2026 18:55
joshuarli
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #131172, fixing this Bugbot finding.
bootstrap-snuba.pybootstrapsdefault_gw0, then copies it to the other worker databases with RESTORE. When a copy failed, the fallback bootstrapped on top of whatever was left over:default_gwN. Its partialmigrations_localcan make snuba bootstrap skip migrations, so the tests would run against a broken schema.OSError, so it started the fallback while ClickHouse could still be running the RESTORE on the server. Over HTTP, ClickHouse doesn't cancel a non-readonly query when the client disconnects.Each RESTORE now gets a known query ID. The fallback first kills any of those queries that are still running and waits for them to stop. Then it drops every target database, and only then bootstraps them. ClickHouse documents KILL QUERY as the way to cancel a restore. If the kill or a drop fails, phase 1 fails instead of bootstrapping on top of a partial database.
The copy-or-fallback logic moves out of
main()intocopy_or_bootstrap()so it can be unit tested. The happy path doesn't change.via @joshuarli.
--
View Session [Sentry]