Repository navigation
Conversation
The line `the shared table was written at the part bound` asserted an optional path of the pressure valve. A sweep's claim that reaches a part goes to a producer-local table, and only a tail smaller than a part is drained into the shared table, which `AdaptiveAggregationSharedTableSpills` counts when it reaches the part bound. When the query's memory falls below `max_bytes_before_external_group_by` between crossings, the backlog has grown past a part at every sweep, every claim goes producer-local, and the shared table only gets the finish drain's remainder, below the bound. The counter then stays 0 with exact results and every other claim intact. Which regime a run settles in depends on where its memory floor sits against the threshold. With the test's own query, one fresh clickhouse-local per run: 0 in 15 of 50 runs at a 40 MB threshold and in 43 of 80 (re-measured: 40 of 80) at 45 MB, while 20 MB gave a minimum of 3 over 2,250 runs, including the SIGPROF thread fuzzer. CI hit the zero once in about 131k runs, on `Stateless tests (arm_binary, parallel)`. Remove the line and its reference, and say in the header why the path is not asserted. The tail detach stays covered: deleting it from `drainStagedChunksBatchUnderMemoryPressure` fails 04650, 05059, 05076, 05099 and 05100 in every run. 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), plus my own review of the same tree (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-11:20261006-171100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261006-155600 |
|
Workflow [PR], commit [3189d14] Summary: ✅ AI ReviewSummaryThis PR removes the flaky Findings
Final Verdict
|
| # spill. The thresholds are pinned because the runner randomizes them, and `max_memory_usage` is the | ||
| # cell that encodes the claim: ten times the threshold the query asked to spill at. | ||
| # table, so the shape usually covers that table's path to disk as well as the producer-local one. | ||
| # That is not asserted: when the backlog has grown past a part at every crossing, every batch goes |
There was a problem hiding this comment.
This fixes the flake, but it also drops the only direct check of the shared-tail spill path. The remaining assertions still prove that pressure drains happened, yet they no longer prove that the shared residue ever crossed the part bound. That matters because the shared path accounts memory through shared.early_drain_tracked_bytes / sharedDrainTableBytes in src/Interpreters/AdaptiveAggregationKernels.cpp, while producer-local drains correct their reservation through a different code path. After this change, a regression in the shared-table spill trigger or accounting can pass unnoticed whenever every pressure claim routes producer-local.
Can we keep a deterministic assertion for the shared-table path here, or add a tiny dedicated stateless test that exercises it directly?
8c4cf25
Related: #123673
Related: #117880
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
05097_adaptive_aggregator_heap_state_valve_memoryprintedthe shared table was written at the part bound 0inStateless tests (arm_binary, parallel)on #123673, a FileLog-only PR. Every other line held. That is 1 failure in about 131k runs since the test landed in #117880, and 0 on master.The line asserts an optional path. A pressure sweep's claim that reaches a part goes to a producer-local table. Only a smaller tail is drained into the shared table, and
AdaptiveAggregationSharedTableSpillscounts that table when it reaches the part bound. When the query's memory falls below the spill threshold (max_bytes_before_external_group_by) between crossings, the backlog has grown past a part at every sweep. Every claim then goes producer-local, and the shared table never reaches the bound. That is the designed routing. Whether a run ends up there depends on where its memory floor sits against the threshold. With the test's own query at a 45 MB threshold (limit 450 MB), 40 of 80 runs read 0, all with exact totals and every other claim held.This PR removes the line and its reference and rewrites the header sentence about it.
The tail detach the line witnessed is still caught: with it deleted from
drainStagedChunksBatchUnderMemoryPressure, 04650, 05059, 05076, 05099 and 05100 fail in 5 of 5 runs (Code: 241, or a spill counter at 0). Without the deletion they pass 5 of 5. What is given up: no test assertsAdaptiveAggregationSharedTableSpillsany more, so this heap-state shape is no longer proven to take the shared-table path; that would need another shape or a new observable.Validation: the new test matches its reference on debug, ASan and
amd_binary;--test-runs 50 -j 5050/50 OK; 0/400 diffs under the SIGPROF thread fuzzer.Note: #123531 deletes this test as part of an aggregator rewrite.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124289]
Version info
26.10.1.1706-master(included in26.10and later)