Repository navigation
Fix ignore_drop_queries_probability breaking dependencies during DROP DATABASE - #102506
Merged
Merged
Conversation
…g DROP DATABASE The stress test setting `ignore_drop_queries_probability` could selectively ignore individual table drops within a `DROP DATABASE` operation. Since `DROP DATABASE` skips same-database dependency checks (by design), this could leave a dependent table alive while dropping the table it depends on. For example, table A with a TTL referencing table B: if A's drop is ignored but B's drop proceeds, the server cannot restart because A's TTL expression references a nonexistent table B. The fix disables `ignore_drop_queries_probability` for table drops that are part of a `DROP DATABASE` operation, similar to how it's already disabled for secondary queries and refreshable materialized views. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100300&sha=4bcde9f5e2ff130c9fdb0192330170491c0b9015&name_0=PR&name_1=Stress%20test%20%28arm_debug%29 Related PR: #100300 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [f1c0f88] Summary: ✅ AI ReviewSummaryThis PR fixes a real stress-test failure mode where ClickHouse Rules
Final Verdict
|
Contributor
LLVM Coverage Report
Changed lines: 100.00% (10/10) | lost baseline coverage: 2 line(s) · Uncovered code |
shankar-iyer
approved these changes
Apr 13, 2026
This was referenced Aug 15, 2026
bacek
pushed a commit
to bacek/ClickHouse
that referenced
this pull request
Aug 15, 2026
…rder `DatabaseCatalog::checkTableCanBeRemovedOrRenamedUnlocked` skips dependent tables from the same database when the removal comes from `DROP DATABASE`, and carried a TODO asking for tables to be unloaded in reverse topological order instead. That ordering exists since ClickHouse#97057: `InterpreterDropQuery::executeToDatabaseImpl` sorts the tables of a `DROP DATABASE` in reverse loading dependency order, so a dependent is always dropped before the table it depends on. The skip here is still required - the dependency graph is consulted per table while the database is being emptied - so only the obsolete TODO is replaced by a pointer to the code that maintains the invariant. Related: ClickHouse#87369 Related: ClickHouse#102506 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.
The stress test setting
ignore_drop_queries_probabilitycould selectively ignore individual table drops within aDROP DATABASEoperation. SinceDROP DATABASEskips same-database dependency checks (by design), this could leave a dependent table alive while dropping the table it depends on.For example, table A with a TTL
WHERE a IN (SELECT a FROM B)referencing table B: if A's drop is ignored but B's drop proceeds, the server cannot restart because A's TTL expression references a nonexistent table B.The fix disables
ignore_drop_queries_probabilityfor table drops that are part of aDROP DATABASEoperation, similar to how it's already disabled for secondary queries and refreshable materialized views.Root cause analysis of the Stress test (arm_debug) failure in #100300:
02908_table_ttl_dependencycreates02908_mainand02908_dependent(TTL WHERE references02908_main) intest_3ignore_drop_queries_probability=0.2— both tables survive03655_keeper_map_alter_comment) runsDROP DATABASE IF EXISTS test_302908_dependentfirstDROP TABLE 02908_dependentis randomly ignored (20% probability)DROP TABLE 02908_mainpasses the dependency check (same-database dependents are skipped forDROP DATABASE) and succeeds02908_dependentis orphaned with a TTL referencing nonexistent02908_mainUnknown table expression identifier 'test_3.02908_main'CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100300&sha=4bcde9f5e2ff130c9fdb0192330170491c0b9015&name_0=PR&name_1=Stress%20test%20%28arm_debug%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
🤖 Generated with Claude Code
Version info
26.4.1.865