Repository navigation
Add regression test for reading Array .size0 subcolumn across granules - #109090
Conversation
Reading an Array .size0 subcolumn together with the full Array column across many granules of a compact part goes through the offsets stream append path in SerializationArray::deserializeOffsetsBinaryBulk. A background merge that read offsets across granules while the offsets column was shared with the reader result could reallocate a buffer another holder still pointed at, surfacing as a SIGSEGV in the offsets resize under sanitizers. The compact reader read/build path was made COW-safe upstream, so the offsets column is now solely owned at the in-place resize. This test guards the Array variant (the sibling of the String .size case) against regressions: it reads the .size0 subcolumn and the full array across granules and asserts the sizes are correct. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Verified against master HEAD 2a3a502 with an ASan build. Session id: cron:clickhouse-worker-slot-3:20260701-190000 |
|
Workflow [PR], commit [82bdf21] Summary: ✅ AI ReviewSummaryThis PR turns Final Verdict✅ No new inline findings for the current |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 82 line(s), 4 function(s) across 35 file(s) · Details Top files
|
|
Done: switched the changelog category to |
CI finish ledger - c92d2f0Every failure below has an owner (a fixing PR). None is PR-caused: this PR is regression-test-only (adds one stateless test) and cannot cause a suite-wide job-wrapper error.
Session id: cron:our-pr-ci-monitor:20260702-050000 |
CI finish ledger — c92d2f0Every failure below has an owner. This PR is regression-test-only (2 files:
#109096 root-causes this exact exit-125 signature: a praktika watchdog bug in Session id: cron:clickhouse-worker-slot-2:20260702-045900 |
MergeTreeReaderCompact::readData has two subcolumn branches. With per-substream marks it reads the subcolumn through its serialization; without them it reads the full column and extracts the subcolumn in memory. Only the second branch appends into a possibly shared column, and it is reachable only for parts written with write_marks_for_substreams_in_compact_parts = 0. That setting now defaults to 1, so the test only exercised the first branch. Pin the setting explicitly and keep a second table pinned to 1, so both branches are covered, and assert the part type and the pinned value so the pins cannot silently stop taking effect. An explicit per-DDL SETTINGS value wins over the test runner's randomization injection (ClientBase::addMergeTreeSettings only adds a randomized value when the DDL does not already set it), so no blanket no-random-merge-tree-settings tag is needed; verified with 50 randomized runs. Also drop the reference to test 04409_string_size_subcolumn_shared_buffer_merge, which does not exist: its PR was closed unmerged.
Checking system.tables.engine_full only proves that different setting values were recorded. The reader selects its branch from the part's mark type, so if writing ever stopped honouring either pin both tables would exercise the same branch while every result assertion still passed. Assert through mergeTreeIndex(..., with_marks = true) instead: the a.size0 substream must have no mark without substream marks and a mark with them. Both directions verified by mutation.
The test runner randomizes index_granularity_bytes down to 1 KiB, which makes granule sizes vary and can leave granules with 0 rows, so a read with a large block no longer reliably spans fixed-size granules. Pin it, and assert the precondition: several granules, all 32 rows. Pin it to a large value rather than 0. index_granularity_bytes = 0 turns off adaptive granularity (MergeTreeData::canUseAdaptiveGranularity), and a non-adaptive part must be Wide, which would drop the compact-part premise of this test entirely. The trailing mark of a part is a sentinel with rows_in_granule = 0, so the granule assertions count only granules with rows.
CI finish ledger - 82bdf21CI fully finished on this head (no check queued or in progress, the praktika aggregator Session id: cron:our-pr-ci-monitor:20260729-093000 |
Related: #107457
Related: #106370
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
Regression test only, no code change. Covers reading an Array
.size0subcolumn together with the full Array column across many granules of a compact part.MergeTreeReaderCompact::readDatahas two subcolumn branches. With per-substream marks it reads the subcolumn through its serialization; without them it reads the full column and extracts the subcolumn in memory. Only the second branch appends into a possibly shared column, and it is reachable only for parts written withwrite_marks_for_substreams_in_compact_parts = 0. That setting defaults to1, so the first version of this test only exercised the first branch. The test now pins the setting on one table and pins1on a second table, so both branches are covered.The pins are asserted through the effective layout rather than the recorded DDL text:
mergeTreeIndex(..., with_marks = true)must report no mark for thea.size0substream on the first table and a mark on the second, and both parts must be Compact with several 32-row granules.index_granularity_bytesis pinned too, because the runner randomizes it down to 1 KiB, which makes granule sizes vary; it is pinned to a large value rather than0because0turns off adaptive granularity and a non-adaptive part must be Wide. An explicit per-DDLSETTINGSvalue wins over the runner's randomization injection (ClientBase::addMergeTreeSettingsonly adds a randomized value when the DDL does not already set it), so no blanketno-random-merge-tree-settingstag is needed; 50 randomized runs pass.Scope note: this test does not fail on a revert of the
IColumn::mutatechange in #107457. In the fallback branch the destination column is uniquely owned on every read (measured: 3750 entries,use_count1 in all), andIColumn::mutatediffers fromassumeMutableonly aboveuse_count1. The value here is branch coverage, not a fail-without-fix guard.Version info
26.8.1.405(included in26.8and later)