Repository navigation
Fix flaky test 04023_rollup_totals_memory_limit - #106679
alexey-milovidov merged 1 commit into
Conversation
Lower `max_memory_usage` from 10 MB to 1 MB so the expected `MEMORY_LIMIT_EXCEEDED` exception is hit deterministically. The previous limit (10 MB) sat just below the observed aggregator footprint of ~12 MiB. The 1.2x margin is too thin: certain randomized settings (in `Stateless tests (amd_debug, distributed plan, s3 storage, parallel)` and `Fast test`) shave off 2-3 MiB and let the query slip under the limit, so `MEMORY_LIMIT_EXCEEDED` is never thrown and the test fails with "query succeeded but server error 241 was expected". With a 1 MB limit the aggregator footprint (5-6 MiB observed locally across 50 random setting combinations) is firmly above the threshold, so the exception fires deterministically. The regression target from issue ClickHouse#93465 (server crash inside ROLLUP+TOTALS memory-limit handling) is still exercised: any `MEMORY_LIMIT_EXCEEDED` thrown cleanly proves the crash path is not reached. Requested by @ alexey-milovidov on ClickHouse#106187 Related: ClickHouse#93465 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-ci-task-worker:20260607-142300 |
|
cc @KochetovNicolai - could you review this? Test-only fix for the flaky 04023_rollup_totals_memory_limit: lowers max_memory_usage from 10 MB to 1 MB so the expected MEMORY_LIMIT_EXCEEDED is reached deterministically (current 1.2x margin between aggregator footprint and limit is too thin for some randomized settings combinations to satisfy). |
|
Workflow [PR], commit [d94acd3] Summary: ✅ AI ReviewSummaryThis PR tries to make Findings
Tests
Final VerdictStatus: Minimum required action: adjust the test so it remains deterministic without moving the failure before the |
| CREATE TABLE t0 (c0 Int, c1 Int128) ENGINE = MergeTree ORDER BY tuple(); | ||
| INSERT INTO t0 SELECT 1, number FROM numbers(40000); | ||
| SELECT countDistinct(c1) FROM t0 GROUP BY c0 WITH ROLLUP WITH TOTALS SETTINGS max_memory_usage = 10000000, max_bytes_before_external_group_by = 0, max_bytes_ratio_before_external_group_by = 0; -- { serverError MEMORY_LIMIT_EXCEEDED } | ||
| SELECT countDistinct(c1) FROM t0 GROUP BY c0 WITH ROLLUP WITH TOTALS SETTINGS max_memory_usage = 1000000, max_bytes_before_external_group_by = 0, max_bytes_ratio_before_external_group_by = 0; -- { serverError MEMORY_LIMIT_EXCEEDED } |
There was a problem hiding this comment.
This lowers the limit enough that the query can fail while building the initial aggregate state, before RollupTransform::generate calls Aggregator::mergeBlocks. That stops the test from covering the regression it links to: issue #93465 failed in the ROLLUP merge path (RollupTransform -> Aggregator::mergeBlocks -> AggregateFunctionUniq::merge), not merely anywhere in this query shape.
Please keep the test deterministic without moving the exception before ROLLUP/TOTALS processing. For example, tune the input/limit so the base aggregation completes and the MEMORY_LIMIT_EXCEEDED is raised from the rollup merge path, or add evidence in the test that the exception still comes from that path.
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 401 line(s), 55 function(s) across 120 file(s) · Details Top files
|
CI ledger — covered SHA: d94acd3CI fully finished (Finish Workflow = SUCCESS at 22:11:44Z, all 166 checks completed, no in-progress/queued, >20 min ingestion buffer elapsed). Zero test failures in CIDB on this commit. |
Lower
max_memory_usagefrom 10 MB to 1 MB so the expectedMEMORY_LIMIT_EXCEEDEDexception is hit deterministically across all randomized settings combinations.The previous limit (10 MB) sat just below the observed aggregator footprint of ~12 MiB. The 1.2x margin is too thin: certain randomized settings on
Stateless tests (amd_debug, distributed plan, s3 storage, parallel)andFast testruns shave off 2-3 MiB and let the query slip under the limit, soMEMORY_LIMIT_EXCEEDEDis never thrown and the test fails with "query succeeded but server error 241 was expected" (22/88 reruns failed on PR #106187).With a 1 MB limit the aggregator footprint (5-6 MiB observed locally across 50 random setting combinations) is firmly above the threshold, so the exception fires deterministically.
The regression target from issue #93465 (server crash inside ROLLUP+TOTALS memory-limit handling) is still exercised: any
MEMORY_LIMIT_EXCEEDEDthrown cleanly proves the crash path is not reached.Requested by @ alexey-milovidov on #106187
Related: #93465
CI report (the run that prompted this fix): #106187
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...