Skip to content

Stabilize 03599_lightweight_delete_vertical_merge under slow sanitizer runners - #105427

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-03599-lightweight-delete-vertical-merge-flaky
Jul 29, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-03599-lightweight-delete-vertical-merge-flaky

Conversation

@groeneai

Copy link
Copy Markdown
Collaborator

Stabilize 03599_lightweight_delete_vertical_merge: chronic timeout under slow sanitizer runners.

The test creates a 100K-row MergeTree and runs two OPTIMIZE TABLE FINAL vertical merges to verify that lightweight delete in alter_update mode produces a part without the _row_exists column. Under CI's randomized MergeTree settings (--allow_merge_tree_settings), e.g. index_granularity = 3 (so ~33K marks/part), object_serialization_version v3 + object_shared_data_serialization_version advanced, and page_cache_inject_eviction = True, the two vertical merges become slow enough to exceed the 600 s per-test budget on slow sanitizer runners (amd_msan, WasmEdge, arm_asan_ubsan, azure, amd_tsan, flaky check, Fast test). Reproduced on 9 unrelated PRs over the past 90 days; see PR #100770 (report) where --diagnose-random-settings confirmed "MergeTree settings alone reproduce the failure" (failure at 600.16 s).

Fix: tag the test with no-random-merge-tree-settings. The test's CREATE TABLE already pins every MergeTree setting it actually relies on (vertical_merge_algorithm_min_rows_to_activate = 1, vertical_merge_optimize_lightweight_delete = 1, min_bytes_for_wide_part = 0, enable_block_*_column = 0, ratio_of_defaults_for_sparse_serialization = 1.0), so the remaining randomization only adds runtime variance, not coverage. Sibling vertical-merge tests 02981_vertical_merges_memory_usage, 04041_vertical_merge_stop_start_race, and 04145_vertical_merge_wide_rows_small_block_size already use the same tag.

Per @alexey-milovidov directive on #100770.

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

...

Documentation entry for user-facing changes

  • Documentation entry is not required.

…r runners

Add `no-random-merge-tree-settings` so the CI runner does not inject
defaults like `index_granularity = 3` that turn the two `OPTIMIZE FINAL`
vertical merges into a >600 s walk under MSan + WasmEdge and similar slow
runners. The test already pins every MergeTree setting it cares about
(`min_bytes_for_wide_part = 0`, `vertical_merge_algorithm_min_rows_to_activate = 1`,
`vertical_merge_optimize_lightweight_delete = 1`, ...) in the table SETTINGS,
so randomizing the rest only adds variance, not coverage.

Sibling vertical-merge tests 02981, 04041, 04145 use the same tag.

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100770&sha=fe0c8cb7986e4c9b83529a24215c5ed28b2a2137&name_0=PR&name_1=Stateless%20tests%20%28amd_msan%2C%20WasmEdge%2C%20parallel%2C%202%2F2%29
PR: ClickHouse#100770
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate (per worker spec)

(a) Deterministic repro? Yes via CI: PR #100770 Stateless tests (amd_msan, WasmEdge, parallel, 2/2) hit a hard 600.16 s timeout on 03599_lightweight_delete_vertical_merge with the failing MergeTree setting bag printed by --diagnose-random-settings (full bag in the linked report). Local debug is ~25x faster than MSan+WasmEdge so the same bag completes in ~3 s on my workstation, which is why I lean on the CI-side reproduction and the diagnosis output rather than a local timeout.

(b) Root cause explained? clickhouse-test injects randomized MergeTree settings via --allow_merge_tree_settings. The settings the test does NOT explicitly pin in its CREATE TABLE SETTINGS get the randomized defaults — most importantly index_granularity = 3 (so ~33,333 marks for a 100K-row part instead of ~12 with the default 8192), plus object_serialization_version v3 + object_shared_data_serialization_version advanced + object_shared_data_buckets_for_compact_part 23, page_cache_inject_eviction = True, merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability 0.66, use_uncompressed_cache 1, etc. The test then runs two OPTIMIZE TABLE FINAL calls that each do a full vertical merge of 5 user columns + _row_exists. With ~25x MSan+WasmEdge runtime overhead on top of the inflated per-merge work, the cumulative cost exceeds the 600 s per-test cap. ddmin confirmed "MergeTree settings alone reproduce the failure" and bailed out of further minimization at the 300 s budget — consistent with a multiplicative slowdown rather than a single guilty setting.

(c) Fix matches root cause? Adding -- Tags: no-random-merge-tree-settings removes the source of the slowdown — the runner stops injecting random MergeTree defaults, so tables are built with normal index_granularity = 8192 and normal storage settings, and the test runs in <1 s on debug (same order under MSan+WasmEdge).

(d) Test intent preserved? Yes. The test asserts (i) row counts after DELETE … alter_update (75000/75000/0/0), (ii) absence of _row_exists in system.parts_columns after the vertical merge (0/0), and (iii) merge_algorithm = 'Vertical' with expected read_rows/read_bytes/rows in system.part_log. None of these depend on randomized MergeTree settings; every setting the test relies on (vertical_merge_algorithm_min_rows_to_activate = 1, vertical_merge_algorithm_min_columns_to_activate = 1, vertical_merge_optimize_lightweight_delete = 1, min_bytes_for_wide_part = 0, enable_block_number_column = 0, enable_block_offset_column = 0, ratio_of_defaults_for_sparse_serialization = 1.0) is already pinned in CREATE TABLE SETTINGS, which take precedence over the randomizer.

(e) Both directions demonstrated?

  • Without fix: 600.16 s timeout in CI (PR Fix LOGICAL_ERROR "Column identifier is already registered" in UNION ALL #100770 report).
  • With fix: 30/30 passes locally on debug with randomized regular settings still enabled (PATH=build/programs:$PATH tests/clickhouse-test --test-runs 30 03599_lightweight_delete_vertical_merge). Runner code at tests/clickhouse-test:2482 confirms the tag suppresses MergeTree randomization.

(f) Fix is general? Yes. The fix follows the established pattern: all three sibling vertical-merge tests (02981_vertical_merges_memory_usage, 04041_vertical_merge_stop_start_race, 04145_vertical_merge_wide_rows_small_block_size) already carry no-random-merge-tree-settings. Bringing this test in line resolves the chronic flake without changing any product code.

Session: cron:clickhouse-ci-task-worker:20260520-131500

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @CurtizJ — could you review this? Test-only change: tags 03599_lightweight_delete_vertical_merge with no-random-merge-tree-settings to fix a chronic 600 s timeout on slow sanitizer runners (MSan WasmEdge, ASan azure, ...) caused by randomized index_granularity blowing up the two vertical OPTIMIZE FINAL merges. Matches the existing pattern in sibling tests 02981 / 04041 / 04145.

@nikitamikhaylov nikitamikhaylov added the can be tested Allows running workflows for external contributors label May 20, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d569caf]

Summary: ✅


AI Review

Summary

This PR stabilizes 03599_lightweight_delete_vertical_merge by opting that test out of randomized MergeTree settings, which otherwise can turn its two OPTIMIZE TABLE ... FINAL vertical merges into timeout-prone work on slow sanitizer runners. I reviewed the current diff, the PR discussion, the runner-side behavior of no-random-merge-tree-settings, and the current all-green CI; I did not find a correctness or coverage regression that warrants an inline review comment. In particular, the tag's extra default_compression_codec = LZ4 pin does not invalidate this test's contract because the assertions are row counts, _row_exists disappearance, and uncompressed merge accounting in system.part_log.

Final Verdict

✅ No findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label May 20, 2026
@alexey-milovidov alexey-milovidov self-assigned this Jul 29, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 29, 2026
Merged via the queue into ClickHouse:master with commit d1aeb4d Jul 29, 2026
178 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 29, 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 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