Skip to content

Fix flaky test 05054_adaptive_aggregator_baseline_spill_residue - #124148

Merged
nihalzp merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-flaky-05054-baseline-spill-residue
Oct 9, 2026
Merged

nihalzp merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-flaky-05054-baseline-spill-residue

Conversation

@groeneai

@groeneai groeneai commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #122138
Related: #117880

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

Scenario 1 of 05054_adaptive_aggregator_baseline_spill_residue printed parts stay far below the block count 0 in Stateless tests (arm_binary, parallel) on #122138 and #123144; 0 failures on master. Asked for in #122138 (comment).

The baseline spill decision reads query-wide memory. A frozen thread that gets no CPU while the others thaw and finish the stream keeps its table and staged records resident (20.5-25 MiB), so the thawed threads write one part per block with the residue release in place. Under the CI thread fuzzer (SIGPROF, P=0.02, up to 2 s) the fixed engine reaches 61-62 parts, which is the CI line.

The line is also vacuous: without the release (master before #117326, or the release block deleted) scenario 1 writes 53-58 parts and passes the bound of 60. It became so when the rows were cut from 3M to 1M while the thaw point stayed put.

This PR removes that line and its reference. The release stays covered by residue released and scenario 4's released with live states, which fail on both defect binaries in every run.

Validation: the new test matches its reference on debug, ASan and amd_binary; --test-runs 50 -j 50 50/50 OK; 0/800 diffs under the thread fuzzer, where the current test failed 1/800 with the CI line.

Note: #123531 deletes this test as part of an aggregator rewrite.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/124148]

Version info

  • Merged into: 26.10.1.1929-master (included in 26.10 and later)

`parts stay far below the block count` failed twice in `Stateless tests
(arm_binary, parallel)` (PRs ClickHouse#123144 and ClickHouse#122138) and cannot tell the
defect from a thread that was descheduled.

The baseline spill decision reads query-wide memory. A frozen thread that
gets no CPU while the others thaw and finish the stream keeps its frozen
table and staged records resident (20.5-25 MiB measured), so the thawed
threads spill one part per block with the residue release in place. Under
the SIGPROF half of the CI thread fuzzer (P=0.02, up to 2 s) the fixed
engine writes 61-62 parts and prints exactly the CI line.

The line is also vacuous. Without the release (master before ClickHouse#117326, or
the release block deleted) scenario 1 writes 53-58 parts, under the bound
of 60, so the line passes on the defect. It became so when the rows were
cut from 3M to 1M (499b6e7, bce9bf4) while the thaw point stayed
at 524288 staged records, about 52 blocks before the end of the stream.

The release stays covered by `residue released` and by scenario 4's
`released with live states`: both read 0 on the two defect binaries in
every run and 1 on the fixed engine in every run.

Measured with clickhouse-local (amd_binary of master a2e4282 unless
noted):
- new test: identical to the reference on the debug, ASan and amd_binary
  builds; clickhouse-test --test-runs 50 -j 50 on debug: 50/50 OK;
  thread fuzzer P=0.1/100 ms and P=0.02/2 s, 400 runs each: 0 diffs.
  The current test on the same rig: 1/800 (`parts stay far below the
  block count 0`).
- defect binaries: the new test fails 6/6 on the two counter lines; the
  current parts line passes 6/6.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Oct 6, 2026
@groeneai

groeneai commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings), plus my own review of the same tree (1 nit on the PR description, applied before the gate ran).

# Sev Finding Verdict Evidence / action
1 💡 The description offered a "run scenario 1 twice" part-count variant as a live check AGREE, fixed in the description With the current bound of 60 parts that variant passes on both defect binaries too (53-58 parts), so the offer was removed

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-9:20261006-035800

@clickhouse-gh

clickhouse-gh Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ba707e6]

Summary: ✅


AI Review

Summary

This PR removes the parts stay far below the block count assertion from scenario 1 of 05054_adaptive_aggregator_baseline_spill_residue because that line depends on scheduler interleavings that can keep a frozen thread's table and staged records resident long enough to force one-part-per-block writes even on a fixed build. The remaining assertions still cover the intended contract: scenario 1 still requires AdaptiveAggregationResidueReleases, AdaptiveAggregationPressureSweeps, and AdaptiveAggregationThaws, and scenario 4 still checks that releasing the residue preserves live aggregate states. I do not see an unresolved correctness or coverage regression in the current diff.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Oct 6, 2026
@nihalzp
nihalzp added this pull request to the merge queue Oct 9, 2026
Merged via the queue into ClickHouse:master with commit fd2fd5f Oct 9, 2026
149 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 9, 2026
@nihalzp nihalzp self-assigned this Oct 10, 2026
@clickhouse-gh clickhouse-gh Bot added comp-aggregation GROUP BY / aggregation framework (hash tables, spilling, external aggregation). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-aggregation GROUP BY / aggregation framework (hash tables, spilling, external aggregation). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants