Repository navigation
Decouple 04321_table_readonly_background_merges from the global TTL merge slot count - #119884
Conversation
…erge slot count max_number_of_merges_with_ttl_in_pool is a per-table setting, but StorageMergeTree::selectPartsToMerge compares it against MergeTreeData::getTotalMergesWithTTLInMergeList(), which returns the single per-server MergeList::merges_with_ttl_counter, and MergeSelectorApplier gates every TTL selector, TTLPartDropMergeSelector included, behind that comparison. The setting defaults to 2, so two concurrent TTL merges on any other table in the same parallel-run server keep this test's writable control table from dropping its expired part for the whole 60 s window, which is the "writable control table TTL did not run in the background" failure. The same predicate also makes the following negative assertion pass for the wrong reason: "readonly ttl rows: 2" holds just as well when no table in the server could have scheduled a TTL merge at all. Pin the setting on both TTL tables so the assertions depend only on this test's own tables, as 02293_part_log_has_merge_reason.sh and 01921_concurrent_ttl_and_normal_merges_zookeeper_long.sh already do for the same reason. Measured on a debug build: with the pin the expired part is dropped while two TTL merges from another database hold the counter, without it the drop is not selected until the counter frees. Dump system.parts and system.merges on a wait timeout, on the failure path only, so the next red says which of the three causes it was: other tables holding the global TTL slots, a pool busy with something else, or nothing ever selected for these tables. Requested by @ alexey-milovidov in ClickHouse#110326 (comment) Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own cold pass
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20260914-043600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260914-004600 |
|
Workflow [PR], commit [3110c6c] Summary: ✅ AI ReviewSummaryThis PR hard-pins Final Verdict✅ Approved |
4580174
Related: #110326
Related: #111925
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Requested by @ alexey-milovidov in #110326 (comment), where this test failed on the private mirror with
writable control table TTL did not run in the background.max_number_of_merges_with_ttl_in_poolis per-table, butStorageMergeTree::selectPartsToMergecompares it againstMergeTreeData::getTotalMergesWithTTLInMergeList(), the single per-serverMergeList::merges_with_ttl_counter, andMergeSelectorAppliergates every TTL selector behind that comparison. The default is 2 and this test left both TTL tables there, so two concurrent TTL merges on any other table in the same parallel-run server keep the writable control table's expired part undropped for the whole 60 s window, with no leak involved. The same predicate makes the negative assertion pass for the wrong reason:readonly ttl rows: 2holds just as well when no table in the server could schedule a TTL merge at all.So I pin the setting on both TTL tables, as
02293_part_log_has_merge_reason.shand01921_concurrent_ttl_and_normal_merges_zookeeper_long.shalready do, and dumpsystem.partsandsystem.mergeson a wait timeout, on the failure path only..referenceis unchanged.Measured on a debug build: with two TTL merges from another database holding the counter, the pinned table's expired part is dropped while they run and the unpinned one waits for them. Mutation arms, 3 runs each: writable pin to 0 goes red with the dump rendered; deleting the read-only marking goes red (
readonly ttl rows: 1); the same deletion with the read-only pin at 0 goes green, the vacuity that second pin removes. Final state passes 50/50 with randomization on.This does not replace #111925, which fixes the engine-side booking leak on the
DROP/DETACHpath: that leak is one way to reach this state, and the coupling needs none. The failing job is private and unreadable with my credentials, so the analysis is from public sources. I did not measure04267_ttl_drop_merge_no_data_read, named alongside this test in the 2026-08-07 comment on #96130.Workflow [PR]
Sync PR [sync-upstream/pr/119884]
Version info
26.10.1.216(included in26.10and later)