Skip to content

Fix flaky 04249_min_allocation_size_to_throw_on_memory_limit - #127979

Merged
alexey-milovidov merged 4 commits into
masterfrom
fix/04249-grep-single-match
Oct 29, 2026
Merged

alexey-milovidov merged 4 commits into
masterfrom
fix/04249-grep-single-match

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

grep -o -m1 stops after the first matching line but prints every match on that line. When the MEMORY_LIMIT_EXCEEDED error message mentions the code twice on one line, the test outputs it twice and fails, as in Fast test on 2026-10-26 in #115050 and #117170:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=115050&sha=022cfff09c991631c8a4b90abf39ced8c2caec5b&name_0=PR&name_1=Fast%20test

This change keeps only the first match with head -n1.

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):

...

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.892-master (included in 26.11 and later)

`grep -o -m1` stops after the first matching line, but prints every match
on that line. When the error message contains `MEMORY_LIMIT_EXCEEDED` twice
on one line, the test printed it twice and failed in `Fast test`, e.g.
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=115050&sha=022cfff09c991631c8a4b90abf39ced8c2caec5b&name_0=PR&name_1=Fast%20test
(#115050). Keep only the
first match with `head -n1`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c2dbb50]

Summary: ✅


AI Review

Summary

The PR stabilizes 04249_min_allocation_size_to_throw_on_memory_limit by retaining only the first MEMORY_LIMIT_EXCEEDED match with head -n1. The existing reference comparison still rejects output missing the expected exception. No actionable findings.

Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Oct 27, 2026

@rienath rienath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to merge as is, but would be nice to fix the root cause (either here or in follow-up). This happens because ClientBase stores client-side exceptions by wrapping their already formatted text in a new Exception, so the Code: N. DB::Exception: ... (NAME) part gets added again. When the memory limit is hit on the client side, the code shows up twice on one line. We can see it with

 clickhouse local -q "SELECT 1"  --format NonexistentFmt.
Code: 73. DB::Exception: Code: 73. DB::Exception: Code: 73. DB::Exception: Unknown format NonexistentFmt. Maybe you meant: []. (UNKNOWN_FORMAT) (version 25.11.2.24 (official build)). (UNKNOWN_FORMAT) (version 25.11.2.24 (official build)). (UNKNOWN_FORMAT)

@rienath rienath self-assigned this Oct 27, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127979&sha=a7316800a92f8e6e1dc7ce84ae62cd004ade1594&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29 (05227_mutate_part_ahead_of_table_metadata_version_mergetree: the rewrite dropped the column is 1 instead of 0 in Fast test (arm_darwin)) and provide a fix in a separate PR. If the fix is already in progress, link it here. This PR only changes the 04249 test script.

@rienath, thanks for the root-cause analysis. Fixing the doubled Code: N. DB::Exception: prefix in ClientBase changes the client error output for every client-side exception, so it should be a separate follow-up PR; this one keeps the test stable in the meantime. I merged the latest master into the branch.

@groeneai

Copy link
Copy Markdown
Collaborator

The fix is in progress: #127925 (test-only, old_parts_lifetime = 0 for the test table).

Cause: DETACH PARTITION 1 leaves the empty covering part 1_1_1_1, which still has c, on disk for old_parts_lifetime. A later clickhouse-local run loads it as active while outdated parts are still loading, so the query sees c unless the background rewrite of that part has committed first. In the last 2 days the test failed with this exact diff in 40 of 104 Fast test (arm_darwin) runs and 10 of 374 Fast test runs.

Fast test (arm_darwin) was enabled in PRs after the #127925 branch point, so the fix has not run there yet. I can merge master into it to get that run, if you want it before merging.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, thanks — #127925 is merged, so I merged the latest master into this branch to pull in the fix for 05227_mutate_part_ahead_of_table_metadata_version_mergetree. The ClientBase doubled-prefix root cause mentioned by @rienath stays a separate follow-up.

@rienath rienath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can create the PR with fix now. If it merges faster, this PR can be closed

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 The only failure, 05397_clickhouse_local_locked_path_untouched in Fast test (arm_darwin), is not related to this PR. It was fixed on master by #128088, which skips the test on macOS, so I merged the latest master into this branch.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit 72366f9 Oct 29, 2026
180 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/04249-grep-single-match branch October 29, 2026 22:04
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 29, 2026
@clickhouse-gh clickhouse-gh Bot added comp-memory Memory management infrastructure: allocators (Allocator, Arena, PODArray), memory tracking, memor... 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

comp-memory Memory management infrastructure: allocators (Allocator, Arena, PODArray), memory tracking, memor... 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.

4 participants