Repository navigation
Make the remembered verdict of 05324_adaptive_aggregator_disable_thaw independent of how numbers_mt splits rows - #128084
Conversation
… independent of how numbers_mt splits rows The last cell expects its first run to store a positive staging verdict so that the second run is refused the adaptive aggregator. That verdict is a vote of threads: `Aggregator::adaptiveStagingVerdict` needs half of the producers whose tables froze to be repeat-dominated, and a producer is repeat-dominated only if it thawed or, still frozen, staged at least 65536 records that repeat past the bound. `numbers_mt(2000000)` gives its 4 streams 8192-row blocks from one shared cursor, and `system.numbers` reads are treated as evenly distributed, so there is no resize before the aggregation: each producer gets exactly the blocks its source grabbed. Under load one thread can read most of the 245 blocks. It thaws, but the other three froze on a block or a few and vote "not dominated", so the stored verdict is false, the second run freezes and thaws again and the cell prints `1 0 1 1`, as in all three CI failures. Run the last cell on two threads. The producer that reads at least half of the input (1000000 rows over 20000 keys) always thaws, and its vote alone is half of the frozen producers, so the verdict is positive for any split, including 2000000/0. Two streams keep the cell on the adaptive path. The other cells only assert that some thread thawed or staged records, which holds for any split, and keep four threads. With a local patch that gives one block to every stream but the first in the first numbers_mt query of the process, the old cell printed `1 0 1 1` in 20 of 20 runs (run 1 split 1975424/8192/8192/8192, one thaw, verdict `adaptive_staging_repeat_dominated=false`) and the new one `1 1 1 1` in 20 of 20; the whole old test failed 10 of 10 with the CI diff and the new one passed 10 of 10. Without hash-table statistics, or with the verdict forced to false, the new cell prints 0 in column 2. 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; 0 findings), plus my own cold review of the diff (0 findings). No findings to adjudicate. Checked: the stored verdict is Session id: cron:clickhouse-review-slot-8:20261028-190800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261028-180400 |
|
cc @nihalzp, could you review this and add the |
|
Workflow [PR], commit [c2b42e2] Summary: ✅ AI ReviewSummaryThe PR stabilizes Final VerdictStatus: ✅ Approve |
CI finish ledger - 616d6f3Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The changed test passed all five stateless flaky check builds, and Session id: cron:our-pr-ci-monitor:20261029-000003 |
Related: #123531
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
05324_adaptive_aggregator_disable_thawfailed 3 times in 30 days on unrelated PRs, always withRemembered verdict 1 0 1 1instead of1 1 1 1: amd_debug, arm_binary, amd_debug, s3 storage.The second run of the last cell was not refused the adaptive aggregator. The verdict that the first run stores is a vote of threads: it needs half of the producers whose tables froze to be repeat-dominated (
Aggregator::adaptiveStagingVerdict).numbers_mt(2000000)gives its 4 streams blocks from one shared cursor and there is no resize before the aggregation, so under load one thread can read most of the 245 blocks. That thread thaws, but the other threads froze on a few blocks, have too little staged evidence to count as repeat-dominated, and outvote it.The last cell now runs on two threads. Of two producers, the one that reads at least half of the input always thaws, and its vote alone is half of the frozen producers, so the verdict is positive for any split. The counters of the other cells need only one thread to thaw or stage records, which holds for any split, so they keep four threads.
Validation: with a local patch (not in this PR) that gives one block to every stream but the first in the first
numbers_mtquery, the old cell prints1 0 1 120/20 (the trace shows a 1975424/8192/8192/8192 split, one thaw, and a stored verdict offalse) and the new one1 1 1 120/20. Without hash-table statistics, or with the verdict forced tofalse, the new cell fails, so the assertion is still live. 100 direct runs and 50 runs each with and without-j 8pass.Workflow [PR]
Sync PR [sync-upstream/pr/128084]
Version info
26.11.1.1531-master(included in26.11and later)