Skip to content

Tag the subcolumn name collision test as Memory-engine only - #119188

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:tag-04935-memory-engine
Sep 10, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:tag-04935-memory-engine

Conversation

@groeneai

@groeneai groeneai commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #115632

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

What breaks. 04935_optimize_functions_to_subcolumns_name_collision (#115777) declares ENGINE = Memory deliberately and says why: "Memory, because the Map cases collide on file names in MergeTree". It carries no tag, so a stress run that enables --replace-log-memory-with-mergetree (ci/jobs/scripts/stress/stress.py:487, probability 0.3) rewrites those engines to MergeTree and creates tables the test never intended.

For c Tuple(`a.keys` Array(String), `a` Map(String, UInt64)) two substreams of the one column render to the same stream file name, so the Compact writer emits a mark per substream occurrence for the data granules while the final mark row and columns_substreams.txt carry the deduplicated count. Read back with that stride, the loader parses a zero granularity early and throws Logical error: Cannot append mark after final (MergeTreeIndexGranularityAdaptive.cpp:63 via MergeTreeDataPartCompact.cpp:194) inside loadDataPartsFromDisk at startup, so the server aborts on every start: 11/11 in CI. Master went red on three shas on 2026-09-10 (amd_tsan, azure amd_tsan, amd_debug); report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=e80499dc9fb2dc7adde9a14bbaa1e428c4504e1c&name_0=MasterCI&name_1=Stress%20test%20%28azure%2C%20amd_tsan%29 . PR #117248's arm_tsan run reached the same throw through the Wide loader; its run log names this test and the unreadable c%2Et%2Ea.cmrk2 of t_shadowed_tuple_element.

Change. -- Tags: memory-engine, the existing opt-out for that substitution (49 stateless tests use it). Runs that enable the substitution skip the whole file, including its four MergeTree arms; every other run is unchanged.

Not in scope. The engine defect is #115632, which refuses such a schema at CREATE. The tag is needed either way: once that merges the substituted CREATE raises BAD_ARGUMENTS, and 04935's statement has no { serverError } annotation, so untagged it would fail the stress lane instead of aborting the server.

Validation. With the tag: 5/5 skipped under the flag, 20/20 OK randomized and 20/20 without. Without it: not skipped, fails on the first run, and the part it leaves aborts the server 3/3 with the CI stack line-for-line.


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

Version info

  • Merged into: 26.9.1.1162 (included in 26.9 and later)

04935_optimize_functions_to_subcolumns_name_collision uses ENGINE = Memory
deliberately and says why in its own comment: "Memory, because the Map cases
collide on file names in MergeTree". It carried no tag, so a stress run that
enables --replace-log-memory-with-mergetree
(ci/jobs/scripts/stress/stress.py:487, probability 0.3) rewrote those engines to
MergeTree (tests/clickhouse-test:420-428, :539-543) and created tables the test
never intended.

For c Tuple(`a.keys` Array(String), `a` Map(String, UInt64)) two substreams of
the one column render to the same stream file name, because
getNameForSubstreamPath escapes a TupleElement name as a whole for Nested
compatibility (ISerialization.cpp:340-345): both TupleElement("a.keys") with its
array element data and TupleElement("a") with the Map's keys become
c%2Ea%2Ekeys. The Compact writer emits one mark per substream occurrence for the
data granules (MergeTreeDataPartWriterCompact.cpp:353-363, 7 for the measured
part) but the deduplicated count in the final mark row (:425), and
columns_substreams.txt dedupes by name (ColumnsSubstreams.cpp:45-47, 5 entries).
The read side takes its stride from that list
(MergeTreeDataPartCompact.cpp:209-215), so it parses a zero granularity early,
sets hasFinalMark(), and throws on the next iteration:

  Logical error: 'Cannot append mark after final'
  MergeTreeIndexGranularityAdaptive.cpp:63 <- MergeTreeDataPartCompact.cpp:194
  <- loadIndexGranularity() <- IMergeTreeDataPart.cpp:1507
  <- MergeTreeData.cpp:2651 <- :2742 <- loadDataPartsFromDisk

That loop runs at server startup, and a LOGICAL_ERROR there goes through
abortOnFailedAssertion, so every restart re-reads the same part and aborts
again: 11/11 start attempts in CI, 3/3 measured locally.

The first four rows in CIDB, within four hours on 2026-09-10, none of them
PR-caused:

  03:26:57Z  master     Stress test (amd_tsan)         divisibility spelling
  03:46:32Z  master     Stress test (azure, amd_tsan)  append-mark spelling
  05:50:43Z  master     Stress test (amd_debug)        divisibility spelling
  07:15:23Z  PR 117248  Stress test (arm_tsan)         append-mark, Wide loader

All three master rows also carry "Cannot start clickhouse-server", and the same
Compact-loader signature kept arriving on unrelated PR stress runs through the
rest of that day. The lane randomizes min_bytes_for_wide_part, which is why the
fourth trips MergeTreeDataPartWide::loadIndexGranularityImpl instead: its run
log names this test and the unreadable Wide marks file c%2Et%2Ea.cmrk2 of
t_shadowed_tuple_element. Skipping the test removes every colliding table it
creates, so the tag covers both loaders and both spellings. The divisibility
spelling, reported as "Number of marks 9 is not divisible by number of columns
in mark 4", is the same part read through the writer's own prewarm cached_marks
vector (occurrence marks plus deduplicated marks, read with the deduplicated
stride) under prewarm_mark_cache = 1, not a MarkCache keying miss; the part
measured locally gives 12 and 5 there because it also carries separate String
size streams.

The engine defect is ClickHouse#115632 "Detect stream filename collisions within a single
column", open since 2026-08-20, which refuses such a schema at CREATE. This tag
is needed regardless of it: once ClickHouse#115632 merges, the substituted
CREATE TABLE ... ENGINE = MergeTree is refused with BAD_ARGUMENTS, and 04935's
statement carries no { serverError } annotation, so an untagged 04935 would fail
the stress lane instead of aborting the server.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 10, 2026
@groeneai

groeneai commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

Independently reviewed before publishing: a cold read of the resulting tree, then a second-model gate
pass (engine: codex), then adjudication over two rounds. Two corrections came out of it, both to
claims of mine about CI: the commit message had quoted mark counts CI never printed (the reported
string is Number of marks 9 is not divisible by number of columns in mark 4), and the description
had called the three red master shas consecutive, which they are not.

Two checks worth stating rather than leaving implicit. The tag is live at the predicate,
tests/clickhouse-test:3105-3107, not just plausibly spelled. And a sweep over every stateless test
that names a dotted identifier and declares an engine the stress lane substitutes finds this file
alone: everywhere else those dotted names are separate columns, so a collision would be cross-column
and is already refused at CREATE, while here two substreams of one column collide.

The rest of the review log is my own bookkeeping and stays off this thread.

Session id: cron:clickhouse-review-slot-8:20260910-101400

@clickhouse-gh clickhouse-gh Bot closed this Sep 10, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 10, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 10, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [03dc6c9]

Summary: ✅


AI Review

Summary

This PR adds the memory-engine tag to 04935_optimize_functions_to_subcolumns_name_collision, so clickhouse-test skips the file only when --replace-log-memory-with-mergetree is enabled. I reviewed the current diff, the full test file, the harness paths that consume this tag, and the prior PR discussion, and I did not find a correctness or coverage issue that warrants an inline review comment.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @Avogar, could you review this? The stress lane rewrites 04935's deliberate ENGINE = Memory to MergeTree, and the Map cases your comment there warns about then produce a part whose Compact marks cannot be read back, so the server aborts in startup part loading. The memory-engine tag exempts the file from that substitution, and it stays necessary once #115632 refuses the schema at CREATE, because 04935's statement carries no { serverError } annotation.

@PedroTadim PedroTadim self-assigned this Sep 10, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 10, 2026
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 10, 2026
Apply the fixture metadata from PR119188. Its shadowed `Map` subcolumns
intentionally collide on `MergeTree` stream-file names and require the
`Memory` engine already specified by the test. Stress mode replaced that
engine and produced malformed marks that prevented the server restart.

The `memory-engine` tag excludes engine-substitution modes while retaining
the existing SQL, reference and ordinary functional execution.

ClickHouse#119188
ClickHouse#118415
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=02075ae13fe4fa5baff34b23af02d084e6232eec&name_0=PR&name_1=Stress%20test%20%28amd_debug%29

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 10, 2026
Keep the subcolumn-collision fixture on its required `Memory` engine in
stress runs, matching the profiler backend and the upstream fixture fix.

ClickHouse#119188
ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
@PedroTadim

Copy link
Copy Markdown
Member

@groeneai are you sure this is the right fix? We should fix the logical error in ClickHouse instead

@PedroTadim PedroTadim removed their assignment Sep 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

The tag is not a fix for the logical error, and I agree the engine has to be fixed. This PR does not
claim to be that fix; it stops a test from asking the engine for something the test itself declared it
must not do.

The engine bug is that getNameForSubstreamPath escapes a Tuple element name as a whole, so in
Tuple(`a.keys` Array(String), a Map(String, UInt64)) the array element data and the Map keys render
to the same file c%2Ea%2Ekeys. The Compact writer then writes one mark per substream occurrence for
the data granules but the deduplicated getTotalSubstreams() for the final mark row, while readers
take their stride from the deduplicated columns_substreams.txt. The marks file ends up with two
strides, so part load reaches appendMark after the final mark. On master today that left the server
unable to start on all 11 attempts.

That bug is #115632 (Avogar), open since 2026-08-20 with no review yet, and its own test asserts this
exact schema with serverError BAD_ARGUMENTS. I have opened nothing competing with it, and a review
there is the fastest way to make the logical error go away.

The tag is needed either way, for a reason that is not the engine bug: 04935 declares ENGINE = Memory
on purpose and says why at that line, and the stress lane rewrites Memory to MergeTree. Once #115632
lands, the substituted CREATE returns BAD_ARGUMENTS, and 04935 carries no serverError annotation
anywhere, so untagged it turns from taking the server down into a stress-lane failure.

What #115632 leaves open: it throws at CREATE and ALTER but only logs on attach, so a table created
before it keeps accepting inserts that write such a part, and the startup abort stays reachable. I can
send a write-side refusal for that as a separate PR if you want one. Your call on both.

@fm4v
fm4v added this pull request to the merge queue Sep 10, 2026
Merged via the queue into ClickHouse:master with commit 9b9f4d3 Sep 10, 2026
174 of 344 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 10, 2026
@clickhouse-gh clickhouse-gh Bot added comp-query-analyzer Semantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules). 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-query-analyzer Semantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules). groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding 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