Repository navigation
Fix DROP DATABASE hung check caused by ignore_drop_queries_probability - #98333
Merged
Merged
Conversation
…e loop The `ignore_drop_queries_probability` handler in `executeToTableImpl` modifies `ast_drop_query.sync` and `ast_drop_query.kind` via non-const reference. Since `query_for_table` is passed by reference from the loop in `executeToDatabaseImpl`, these modifications persist across iterations: after one table triggers the probability check, all subsequent tables get `sync=false` and potentially `kind=Truncate` instead of `Drop`. This causes: 1. Tables to be truncated instead of dropped, leaving them in the database 2. `detachDatabase` to fail with `DATABASE_NOT_EMPTY` since tables remain 3. The database gets re-attached, but the query waits forever in `waitTableFinallyDropped` for already-dropped tables whose data cannot be cleaned up Fix: save the original `kind` and `sync` values before the loop and restore them at the beginning of each iteration. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98251&sha=d83ec181cd967fac3fe0d13985b408c549b20d68&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
alexey-milovidov
left a comment
Member
Author
There was a problem hiding this comment.
The fix is good.
alexey-milovidov
added a commit
that referenced
this pull request
Mar 1, 2026
Fix DROP DATABASE hung check caused by ignore_drop_queries_probability
1 task
Contributor
|
Hi @alexey-milovidov — the changelog category for this PR might need a look. Current: Why: The code fixes a bug where DROP DATABASE could hang due to ignore_drop_queries_probability modifying query parameters (sync/kind) that should remain constant across multiple table drops. This is a user-visible bug fix, not a CI-only issue. Could you verify this is correct? Ignore if the current category is intentional. |
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.
Summary
ignore_drop_queries_probabilityhandler inexecuteToTableImplmodifiesquery_for_table.syncandquery_for_table.kindvia non-const reference. Sincequery_for_tableis shared across loop iterations inexecuteToDatabaseImpl, these modifications persist: after one table triggers the probability check, all subsequent tables getsync=falseand potentiallykind=Truncateinstead ofDrop.detachDatabaseto fail withDATABASE_NOT_EMPTY, and the query to hang forever inwaitTableFinallyDropped.kind/syncbefore the loop and restore them at the beginning of each iteration.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98251&sha=d83ec181cd967fac3fe0d13985b408c549b20d68&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29
#98251
Test plan
DROP DATABASEstuck inwaitTableFinallyDroppedChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code
Version info
26.3.1.167