Repository navigation
Isolate the mutation in 04068_lwd_minmax_projection_recovery_rmt from merges/mutations pool contention - #120122
Conversation
… merges/mutations pool contention 04068_lwd_minmax_projection_recovery_rmt stops making progress and is killed by the Fast test 60 second per-test cap: 3 failures in 190,994 runs over 45 days, none of them on master, and in the job that surfaced it (ClickHouse#120099) it was the sole red of 15,103 rows. It is a stall rather than a slow test (the OK maximum is 7.0 s over 25,331 Fast test runs and 14.5 s over 10,219 arm_darwin runs, while the failures sit at 60.05 and 60.10 s), and the non-replicated sibling of this test has 0 failures in 190,985 runs. The twelve single-row INSERTs each schedule the merge-selecting task, so twelve iterations run back to back, find nothing mergeable and return AttemptStatus::CannotSelect, which multiplies merge_selecting_sleep_ms up to max_merge_selecting_sleep_ms (60 s). DELETE FROM then creates the mutation, and the single iteration that sees it is refused by the pool-headroom guard in CompactionStatistics::getMaxSourcePartBytesForMutation: max_tasks_count (32) - occupied (25) < number_of_free_entries_in_pool_to_execute_mutation (8) so max_source_part_bytes_for_mutation is 0 and mergeSelectingTask returns AttemptStatus::Limited. Limited matches neither arm of the backoff epilogue, so the saturated 60 second interval is reused verbatim, no MUTATE_PART entry is created, and lightweight_deletes_sync = 2 blocks until max_execution_time fires. With the threshold at 0 the guard's comparison is unconditionally true for this table, so the mutation is assigned on the first iteration that sees it, whatever unrelated parallel tests are doing to the server-global pool. The non-replicated sibling is immune because StorageMergeTree::mutate() calls background_operations_assignee.trigger(), which shrinks its backoff instead of leaving it saturated. Reproduced as a 2x2 over pool occupancy and this diff, on one server and one binary: the pristine file with an occupied pool fails with code 159 after 60.64 s; this diff under the same occupancy passes in 2.69 s with byte-for-byte reference output; both files pass on an idle pool, which places the failure on occupancy rather than on the test. 100 of 100 randomized runs of this test and its plain sibling pass, as do 10 runs each of 02440_mutations_finalization and 03716_mutations_parts_postpone_reasons_rmt. The engine-level starvation, where Limited reuses a saturated interval for every Replicated table, is tracked upstream in ClickHouse#61902 and is deliberately not touched here; this is the same test-side remedy already merged in ClickHouse#118435 and ClickHouse#112090 for the identical log signature. Related: ClickHouse#120099 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; 0 findings; bounded: 1 full pass +
Severity: ❌ blocker / Two harness observations from the failing job, recorded because they cost diagnosis time and are not Session id: cron:clickhouse-review-slot-9:20260915-052700 |
|
Workflow [PR], commit [7086997] Summary: ✅ AI ReviewSummaryThis PR hardens Final VerdictStatus: ✅ Approve |
933221e
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Isolate the lightweight delete in
04068_lwd_minmax_projection_recovery_rmtfrom merges/mutations pool contention, so it no longer wedges at the Fast test 60 second cap.Description
04068_lwd_minmax_projection_recovery_rmtstops making progress and is killed by the Fast test 60 s per-test cap: 3 failures in 190,994 runs over 45 days, 0 of them on master. Two sit at the cap, 60.05 s and 60.10 s; the third is collateral (1.45 s, one of 31 failures in oneFast testjob on an unrelated Keeper PR). In the job that surfaced it (#120099) it was the sole red of 15,103 rows. It is a stall, not a slow test: the OK maximum is 7.0 s over 25,331Fast testruns and 14.5 s over 10,219arm_darwinruns. The non-replicated sibling: 0 failures in 190,985 runs.Root cause: the 12 single-row INSERTs produce 12 back-to-back merge-selecting iterations finding nothing mergeable, and each
CannotSelectmultiplies the poll interval up tomax_merge_selecting_sleep_ms(60 s). The one iteration that then sees the new mutation is refused by the pool-headroom guard and returnsAttemptStatus::Limited, which matches neither arm of the backoff epilogue, so the saturated interval is reused:No
MUTATE_PARTis created for 60 s, solightweight_deletes_sync = 2waits outmax_execution_time.number_of_free_entries_in_pool_to_execute_mutation = 0makes the guard's comparison unconditionally true for this table, so the mutation is assigned on the first iteration that sees it. All four assertions and both synchronous waits are unchanged.The engine-level starvation is open and maintainer-owned (#61902); the identical remedy for this identical log signature was merged in #118435 and in #112090, while my attempt to change the scheduling behaviour instead (#108916) was closed unmerged.
Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120099&sha=13008a61c4b5e2d5c60b9d726afa5ed75ae2a531&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29
Local reproduction: 2x2 over occupancy and this diff (click to expand)
Debug build, CI stateless configs (
tests/config/install.sh ... --fast-test, somax_execution_timeis the lane's own 60 s),BackgroundMergesAndMutationsPoolSize= 32 as in CI.The guard threshold was raised to 31 by a drop-in so that a few occupied slots stand in for CI's 25,
and helper-table merges held
BackgroundMergesAndMutationsPoolTaskat a stable 6 of 32..referenceMUTATE_PARTbefore_deleteA against B is the both-directions proof (same server, same binary, same occupancy, only this diff
differs); A against D shows the failure is occupancy-dependent rather than a broken test. Arm A's
exception is the CI one:
Code: 159 ... elapsed 60084.481 ms, maximum: 60000.000 ms (TIMEOUT_EXCEEDED)onDELETE FROM t_lwd_proj WHERE id < 5, with 59Failed to wait for mutation '0000000000', will rechecklines and noMUTATE_PARTentry.Stability:
clickhouse-test --test-runs 50 --order random 04068_lwd_minmax_projection_recoverycovers both this test and its plain sibling: 100 passed, 0 failed.
02440_mutations_finalizationand
03716_mutations_parts_postpone_reasons_rmt, 10 runs each: 20 passed, 0 failed.Workflow [PR]
Sync PR [sync-upstream/pr/120122]
Version info
26.9.1.1512(included in26.9and later)