Repository navigation
Make a MongoDB table keep its named collection from being dropped - #123636
alexey-milovidov merged 5 commits into
Conversation
`check_named_collection_dependencies` makes `DROP NAMED COLLECTION` throw `NAMED_COLLECTION_IS_USED` only for tables that registered a dependency, and a table engine registers by passing its `StorageID` to `tryGetNamedCollectionWithOverrides`. `StorageMongoDB`'s `getConfigurationImpl` had `table_id` in scope but did not pass it: ClickHouse#96181 added the argument in 2311e59, and its branch merge 468aaca with ClickHouse#89616 (which rewrote the function) kept master's line without it. Every other table engine passes its id. So the drop succeeded under a live MongoDB table, the table could not be attached on the next restart (669), its database became unusable, and with `async_load_databases = 0` the server did not start. The new line is identical to the hunk in ClickHouse#112805. `05315_mongodb_connection_options_secrets` (ClickHouse#123240) dropped its two collections while `e06`, `e07` and `e08` still used them. Stateless CI drops the test database, but Stress keeps it and restarts the server, so master Stress jobs failed with `Cannot start clickhouse-server`. The test now expects the drop to be refused while the tables exist, drops the tables first, and pins `ast_fuzzer_any_query = 0` on every statement that names a collection: the stress profile fuzzes DDL, and a fuzzed `DETACH` of such a table hides it from the catalog, so its dependency is pruned and the collection drop succeeds (the generic detached-table hole, ClickHouse#121519); `__fuzz_N` clones would otherwise also hold the collection and make the final drop fail. Not changed: table functions (`CREATE TABLE ... AS mongodb(nc)`) register no dependency for any engine except `bigquery`; the experimental `MaterializedPostgreSQL` engine has the same omission. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261002-233400 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261002-222900 |
|
Workflow [PR], commit [edd7ed7] Summary: ✅
AI ReviewSummaryThis PR fixes the main Findings
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit edd7ed7.
Changed lines: Changed C/C++ lines covered: 3/3 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 12 s compile time in total, 7 of them have a recent master baseline. |
# Conflicts: # tests/queries/0_stateless/05315_mongodb_connection_options_secrets.sh
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123636&sha=5fd7924e3dea425dc3a2ac43cadda24407c5bd36&name_0=PR&name_1=Fast%20test ( |
|
The fix is already open: #123823 A concurrent test that drops a MergeTree table in a database without table UUIDs (Ordinary, Memory) goes through |
Related: #123240
Related: #123632
Related: #121519
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
DROP NAMED COLLECTIONsucceeding while aMongoDBtable uses the collection, after which the server could not attach the table on restart. The drop is now refused withNAMED_COLLECTION_IS_USED, as for other table engines.Description
On 26.3.33.24 and 26.8.10.6,
DROP NAMED COLLECTION ncsucceeds while a tableENGINE = MongoDB(nc, ...)exists. After a restart the table fails to attach withNAMED_COLLECTION_DOESNT_EXIST, which makes its whole database unusable, and withasync_load_databases = 0the server exits.check_named_collection_dependenciesrefuses the drop only for tables that registered a dependency, andStorageMongoDB'sgetConfigurationImplnever passed itstable_idtotryGetNamedCollectionWithOverrides, unlike other table engines (lost in #96181's merge with #89616). The line is identical to #112805's hunk.This is why master Stress jobs fail with
Cannot start clickhouse-server(arm_tsan, arm_asan_ubsan s3):05315_mongodb_connection_options_secrets(#123240) dropped its collections while MongoDB tables still used them. The test now asserts the drop is refused, drops the tables first, and setsast_fuzzer_any_query = 0on the statements that name a collection, so a fuzzed clone orDETACHcannot strand one. Test-only is not enough: under the stress profile, fuzzer clones ofe06/e07survive #123632'sDROP TABLEand the restart still fails.Validation, base vs fix: all three
MongoDB(nc ...)forms (drop succeeds vs 769, also after a restart); the test fails on base, passes 50/50 randomized; a stress-profile run plus anasync_load_databases = 0restart fails on base, starts on the fix;test_storage_mongodbpasses.Not changed (family-wide gaps): table functions, database engines (#115049), detached tables (#121519), and the same omission in experimental
MaterializedPostgreSQL.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/123636]
Version info
26.10.1.1507-master(included in26.10and later)