Skip to content

Fix flaky test 04267_ttl_drop_merge_no_data_read - #114050

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-flaky-04267-ttl-drop-empty-part-race
Aug 9, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-flaky-04267-ttl-drop-empty-part-race

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Related: #113248
Related: #105859

The test flaked on the amd_msan shard of PR #113248 (CI report) and earlier twice on unrelated PR #96130, with the [] line of Case 2 missing from the output.

Case 2 checks that the part produced by a TTLDropMerge contains no projections, via SELECT projections FROM system.parts WHERE ... AND active. That merge produces an empty part, and MergeTreeCleanupThread calls clearEmptyParts, which drops parts with zero rows in the background (the remove_empty_parts MergeTree setting is enabled by default — its documentation even says "Remove empty parts after they were pruned by TTL"). When the removal wins the race against the check, the query returns zero rows instead of one row with [].

The fix sets remove_empty_parts = 0 on the Case 2 table, so the empty part deterministically stays active for the check. The other cases only query the table itself and system.part_log, both of which are unaffected by empty-part removal. Verified with clickhouse local: after the TTL merge with the setting applied, exactly one active part remains with [] projections and zero rows.

Changelog category (leave one):

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

Version info

  • Merged into: 26.8.1.1056 (included in 26.8 and later)

The `TTLDropMerge` in Case 2 produces an empty part, and the cleanup
thread removes empty parts in the background (the `remove_empty_parts`
MergeTree setting is enabled by default). When that removal wins the
race against the test's `SELECT projections FROM system.parts WHERE ...
active` check, the query returns zero rows instead of the expected `[]`
line. Set `remove_empty_parts = 0` on the Case 2 table so the empty
part deterministically stays active for the check.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113248&sha=0f4ecdf5bcb488588e9d664687d1b482d67d62f9&name_0=PR&name_1=Stateless%20tests%20%28amd_msan%2C%20WasmEdge%2C%20parallel%2C%201%2F3%29
PR: #113248

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [330c150]

Summary: ✅


AI Review

Summary

This PR makes Case 2 of 04267_ttl_drop_merge_no_data_read.sh deterministic by setting remove_empty_parts = 0 on the projection test table, so the empty part created by the TTLDropMerge remains visible in system.parts long enough for the projections assertion. The change matches the flake described in the PR, does not weaken the invariant being tested, and I did not find any correctness or coverage issues in the patch.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 9, 2026

@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.

LGTM

@alexey-milovidov alexey-milovidov self-assigned this Aug 9, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 9, 2026
Merged via the queue into master with commit e493bf7 Aug 9, 2026
181 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-flaky-04267-ttl-drop-empty-part-race branch August 9, 2026 22:31
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 9, 2026
alexey-milovidov added a commit that referenced this pull request Aug 10, 2026
…shape-settings

Pull in the fix for the flaky `04267_ttl_drop_merge_no_data_read` (#114050), which was the only CI red on this test-only pull request.
PedroTadim pushed a commit to groeneai/ClickHouse that referenced this pull request Aug 10, 2026
The test operates on the empty part left by `ALTER TABLE ... DELETE`:
the cleanup thread may drop that part before the `SELECT rows, marks
FROM system.parts ... AND active` check sees it, making the first
reference line disappear. Pin `remove_empty_parts = 0` in the table
settings, the same way ClickHouse#114050 fixed `04267_ttl_drop_merge_no_data_read`.

Failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108078&sha=1588d96287dc9c13f42492972c510487be49b696&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29
PR with the failure: ClickHouse#108078

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants