Skip to content

Harden 02539_vertical_merge_compact_parts instead of skipping under SharedMergeTree - #110537

Merged
alexey-milovidov merged 5 commits into
masterfrom
fix/02539-no-shared-merge-tree
Jul 17, 2026
Merged

alexey-milovidov merged 5 commits into
masterfrom
fix/02539-no-shared-merge-tree

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Related: #110430

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

Not for changelog.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

The test verifies local vertical-merge mechanics (compact to wide parts) by parsing MergeTree part names from system.part_log with splitByChar('_', part_name)[2]::UInt64. With SharedMergeTree, part_log for the table can contain extra entries whose part_name is a filesystem path, so the cast throws CANNOT_PARSE_TEXT (Cannot parse string 'work/clickhouse-private/clickhouse-private/ci/tmp/run' as UInt64) and the test failed whenever MergeTree was replaced with SharedMergeTree.

The initial version of this PR worked around the failure by adding a no-shared-merge-tree tag to skip the test entirely under SharedMergeTree. Per review feedback (SharedMergeTree is perfectly capable of using vertical merges, so skipping the test removes real coverage), the query itself is hardened instead, matching the resolution already applied in the private repository exactly: the hard ::UInt64 casts are replaced with toUInt64OrZero, so a malformed part_name parses to 0 and is filtered out by the existing WHERE min_block = 1 AND max_block = ... clause instead of throwing. The test keeps exercising SharedMergeTree.

Observed in the "CH Inc sync" run of #110430, job "Stateless tests (amd_asan_ubsan, distributed cache, meta in keeper, s3 storage, parallel, 1/2)".

Version info

  • Merged into: 26.7.1.1104 (included in 26.7 and later)

The test verifies local vertical-merge mechanics (compact to wide parts)
by parsing MergeTree part names from `system.part_log` with
`splitByChar('_', part_name)[2]::UInt64`. With `SharedMergeTree`,
`part_log` for the table can contain extra entries whose `part_name` is a
filesystem path, so the cast throws `CANNOT_PARSE_TEXT`:

    Cannot parse string 'work/clickhouse-private/clickhouse-private/ci/tmp/run' as UInt64

Observed in the "CH Inc sync" run of
#110430 in "Stateless tests
(amd_asan_ubsan, distributed cache, meta in keeper, s3 storage, parallel,
1/2)". The test is already listed as cloud-incompatible in the private
repo; this tag makes the shared-merge-tree stateless runs skip it too.

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

clickhouse-gh Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c3146da]

Summary: ✅


AI Review

Summary

This PR hardens 02539_vertical_merge_compact_parts so system.part_log rows with non-merge part_name shapes under SharedMergeTree no longer throw during block-range extraction. I did not find a remaining correctness or coverage regression in the current diff; keeping the test enabled under SharedMergeTree is the right fix.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 15, 2026

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

This change doesn't make sense. SharedMergeTree is perfectly capable of using vertical merges. This is a regression on recent code, which BTW has been addressed by changing the test and not fixing the code, in private

…haredMergeTree

The `min_block`/`max_block` values derived via `splitByChar('_', part_name)`
and a hard `::UInt64` cast were computed in a `WITH` clause and referenced in
the `WHERE` filter, so they got evaluated for every `system.part_log` row of
the table before the `min_block = 1 AND max_block = ...` filter could narrow
them down. Under `SharedMergeTree`, `part_log` for this table can contain
extra rows whose `part_name` is a filesystem path, so the cast threw
`CANNOT_PARSE_TEXT` and failed the test.

Replace the hard cast with `toUInt64OrNull`, so malformed `part_name` values
parse to `NULL` and get filtered out by the `WHERE` clause instead of
throwing, keeping `SharedMergeTree` coverage instead of tagging the test out
via `no-shared-merge-tree` (per review feedback on this change).

Related: #110430
@alexey-milovidov alexey-milovidov changed the title Add no-shared-merge-tree tag to 02539_vertical_merge_compact_parts Harden 02539_vertical_merge_compact_parts instead of skipping under SharedMergeTree Jul 16, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@Algunenano, agreed — I dropped the no-shared-merge-tree tag from the first version of this PR. The test now keeps its SharedMergeTree coverage; only the brittle metadata-extraction query is hardened.

The failure came from eagerly doing splitByChar('_', part_name)[2]::UInt64 on every system.part_log row for the table. Under SharedMergeTree (cloud/private) part_log can contain extra rows whose part_name is a filesystem path, so the cast threw CANNOT_PARSE_TEXT before the min_block/max_block filter ran. The current diff only replaces the two hard ::UInt64 casts with toUInt64OrNull, so such rows parse to NULL and are dropped by the existing WHERE min_block = 1 AND max_block = ... clause instead of throwing. The vertical-merge assertions themselves are unchanged, so the compact→wide vertical-merge behavior is still verified under SharedMergeTree.

This matches the private resolution you mentioned (adjusting the test rather than the vertical-merge code) — the path-style part_name rows are a part_log shape that only exists in the cloud build, not something the public vertical-merge logic can control. Could you take another look?

@Algunenano Algunenano self-assigned this Jul 16, 2026

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

Let's try to match the current status of private exactly instead. I've tried to suggest the change but I'm not sure it worked fine. It's easier to just checkout the file directly

@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110537&sha=4154e251f265d6dc754ca35aee04a73dc4866c51&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20old%20analyzer%2C%20s3%20storage%2C%20DBReplicated%2C%20WasmEdge%2C%20parallel%2C%202%2F3%29 and provide a fix in a separate PR. If the fix is already in progress, link it here.

All five failed tests in this shard are collateral from a single server death (The server is shutting down due to a fatal error. (ABORTED), return code 236) caused by the known race in 03915_exchange_tables_race — tracked in #110133, which has no fix in progress yet. This PR only changes 02539_vertical_merge_compact_parts.sql, which passed. I have re-run the failed job.

@groeneai

Copy link
Copy Markdown
Collaborator

Confirmed: all five failures in this shard are collateral from a single server death (Server died / return code 236, ABORTED), not caused by this PR (which only touches 02539_vertical_merge_compact_parts.sql, and that test passed).

CIDB for this shard/sha (Stateless tests (amd_llvm_coverage, old analyzer, s3 storage, DBReplicated, WasmEdge, parallel, 2/3)):

  • 03915_exchange_tables_race FAIL (Connection refused after the abort) - the trigger
  • 00653_verification_monotonic_data_load, 00700_decimal_casts, 01871_merge_tree_compile_expressions FAIL with return code 236 - collateral after the server was already down
  • Server died / Lost connection to server

Root cause is the 03915_exchange_tables_race race tracked in #110133 (Arguments of 'multiply' have incorrect data types when EXCHANGE TABLES swaps a table's type between analysis and header build, old analyzer).

Fix is in progress, two open PRs:

@alexey-milovidov

Copy link
Copy Markdown
Member Author

The only red on c3146da1 is Stateless tests (amd_tsan, flaky check), and it is unrelated to this PR. It is a server-startup failure, not a test failure: the server aborted during initialization on a TSan data race in DB::DynamicDelay::rotateToMin called from DB::DiskLocalCheckThread::run (SUMMARY: ThreadSanitizer: data race src/Common/DynamicDelay.cpp:69:11 in DB::DynamicDelay::rotateToMin()), so wait_ready timed out and the whole job was marked FAIL — 02539 itself passed on the runs where the server came up.

This is the known DiskLocalCheckThread startup race; the fix is in progress at #110783 (not yet on master, so merging master again does not clear it). The change here is SQL-only (git diff origin/master...HEAD touches only 02539_vertical_merge_compact_parts.sql), and the pre-merge commit 3d91b600 was fully green. Since the race is intermittent, I re-ran the failed job.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 17, 2026
Merged via the queue into master with commit 8ba3d12 Jul 17, 2026
351 of 352 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/02539-no-shared-merge-tree branch July 17, 2026 15:09
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 17, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…red-merge-tree

Harden 02539_vertical_merge_compact_parts instead of skipping under SharedMergeTree
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.

4 participants