Skip to content

Backport #109212 to 26.3: Verify array offsets read as absolute values, not only in the Native format - #118921

Merged
PedroTadim merged 3 commits into
26.3from
backport/26.3/109212
Sep 11, 2026
Merged

PedroTadim merged 3 commits into
26.3from
backport/26.3/109212

Conversation

@robot-clickhouse

@robot-clickhouse robot-clickhouse commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Original pull-request #109212

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 26.3.33.48

@robot-clickhouse robot-clickhouse added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Sep 9, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [516aa7e]

Summary: ❌

job_name test_name status info comment
Integration tests (amd_asan, db disk, old analyzer, 6/6) failure
test_filesystem_cache/test.py::test_bypass_cache_does_not_overread_non_last_segment[node] FAIL cidb
Integration tests (amd_tsan, 6/6) failure
test_filesystem_cache/test.py::test_bypass_cache_does_not_overread_non_last_segment[node] FAIL cidb

@groeneai

groeneai commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

This is my PR being backported, so here is what breaks and the exact change needed.

Only the three ENABLE_TESTS=ON builds fail, and each fails on a single object with 3 errors generated, all three on line 61 of src/DataTypes/Serializations/tests/gtest_serialization_array_offsets.cpp. The ported source half, SerializationArray.cpp (+21/-7, applied verbatim), compiles clean on 26.3. Only my regression test is broken.

Cause: I wrote the test against master, where #96563 ("Added a serialization object pool", merged 2026-03-23) routed construction through static factories and made the constructors inaccessible. 26.3 branched before that, so here SerializationArray.h:14 has a public explicit SerializationArray(const SerializationPtr &) and no create, and SerializationNumber<T> declares no constructor at all, which leaves its implicit default constructor public. Clang typo-corrects create to POSIX creat, which is where the third error ("too few arguments to function call, expected 2, have 0") comes from.

The fix is one line, at 61:

-    auto serialization = SerializationArray::create(SerializationNumber<UInt8>::create());
+    auto serialization = std::make_shared<SerializationArray>(std::make_shared<SerializationNumber<UInt8>>());

That is this branch's own idiom: DataTypeArray.cpp:62-63 builds std::make_shared<SerializationArray>(nested->getDefaultSerialization()) where master reads SerializationArray::create(...), and DataTypeNumberBase.h:57 builds std::make_shared<SerializationNumber<T>>(). No new include is needed, <memory> arrives through ISerialization.h:15. The test never depends on serialization identity or pooling, so a fresh instance is equivalent to a pooled one here. I have not compiled the adapted line, so please treat the three build arms going green as the check.

Nothing else in the file needs adapting. Lines 44 and 62 also read create, but those are the COW column factories; line 39 matches the static deserializeOffsetsBinaryBulk at SerializationArray.h:79; and line 64 matches ISerialization.h:545, which on this branch still takes ColumnPtr & plus rows_offset, exactly as the call is written. I probed line 64 rather than reading anything into the compiler's silence there, since the failure on line 61 suppresses diagnostics for that expression.

I am not proposing to backport #96563: it is a 127-file, 86-commit object-pool refactor, not something that belongs on a stable branch to make a test compile. The alternative, if you prefer no churn, is dropping the affected test from this backport, but that ships the fix to 26.3 without coverage, and the defect is present here: the pre-fix guard on this branch is if (settings.native_format) with an unbounded adjacent_find, so absolute offsets read outside the Native format are unverified.

The 26.6 and 26.7 backports (#118922 and #118923) already have the factories and are merged, so this is 26.3 only.

`SerializationArray` and `SerializationNumber` have no static `create` in
26.3 - the serialization factory was introduced later - so construct them
directly.

Backport: #118921

Co-Authored-By: Claude Opus 5 <[email protected]>
@PedroTadim

Copy link
Copy Markdown
Member

@groeneai can you resolve the conflicts?

@groeneai

Copy link
Copy Markdown
Collaborator

Yes, though the conflicts do not come from the cherry-pick.

The branch head f5e115bf "Fix build of the unit test in the backport" (@ CurtizJ, 2026-09-09) does carry exactly the adaptation I described above, but the same commit also deletes 4,035 files (+1 / -997,602), leaving only src/ and tests/ of the 40 top-level entries. That is what turned this PR CONFLICTING, and it is also why the CI workflows never ran on that head: they live in the deleted .github/.

So the cheapest repair is one push by someone with write access: reset backport/26.3/109212 to the robot commit d11769ca plus that one-line change. I cannot do it myself (maintainer_can_modify: false, and I hold only triage on this repo).

Failing that, I will resolve it from my fork against 26.3, carrying the cherry-pick and the ctor adaptation, in the shape of #116837 and #114814. I am starting on that now and will link it here; if you or @ CurtizJ prefer to fix the branch in place instead, say so and I will drop mine.

@groeneai

Copy link
Copy Markdown
Collaborator

I have opened #119263 against 26.3: the robot's own two-file content on the current branch tip, with the one line adapted, byte-identical to the adaptation already applied here at f5e115bf. Validated with clang-21, which 26.3 pins: the translation unit that failed here compiles clean, all 8 SerializationArrayOffsets cases pass, and 3 of the 8 redden with the source hunks reverted.

I did not push here: this branch's head f5e115bf carries that adaptation together with a whole-repository deletion, +1 / -997,602 over 4033 files, so it cannot merge and no workflow can trigger on it, .github/ being among the deleted paths.

If you would rather the fix land on this branch, so that #109212's Backported to list picks up 26.3 (it scans this exact head ref), the cleanest form is a force-push resetting it to d11769ca6 plus that one line, and I have no write access here (push: false, maintainerCanModify: false). A plain fast-forward would also work, but it would leave the deletion and its restore in 26.3's history permanently. Say which you prefer and I will close the other.

@groeneai

Copy link
Copy Markdown
Collaborator

#119263 is closed, so a fork PR against the release branch is not the shape you want. Understood: I will not reopen it, and I will not open another one against 26.3.

That leaves this branch, and one measurement decides how it can be repaired. On top of the robot commit d11769ca, the head f5e115bf deletes 38 of the 40 top-level entries, -997,602 lines, leaving only src/ and tests/. Backports here land as real merge commits (#118922 and #118923 both merged with two parents), so whatever sits on this branch reaches 26.3 permanently. Any repair I can publish myself is a PR based on backport/26.3/109212, and its head has to restore those entries in a second commit, so 26.3 would carry both the deletion and the restore forever.

Resetting this branch to d11769ca plus the one-line change avoids that completely, and gives 26.3 the same single-commit shape that 26.6 and 26.7 already have. I hold only triage here, so I cannot push it.

Your call, and I am ready to act on any of these:

  1. someone with write access force-pushes that reset (the exact line is in my 2026-09-09 comment above);
  2. or I publish the restore-plus-fix PR against backport/26.3/109212 today, accepting the two extra commits in 26.3;
  3. or the 26.3 leg is dropped.

If 3, one caveat worth knowing first: closing this PR does not free 26.3 to be re-backported by a later label. cherry_pick.py:793-796 searches backport/* heads with no state filter, unlike :845-848, :161-163 then sets _backported = True on any match, and :176 returns, so a closed PR here still reads as already backported.

Resolves the conflicts with 26.3 and restores the 4033 files that
f5e115b removed by accident: that commit was meant to be only the
one-line unit-test build fix its message describes, but it also deleted
most of the tree.

The merged tree is exactly 26.3 plus the intended backport - the two files
of d11769c, with SerializationArray::create replaced by make_shared in
the unit test.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@PedroTadim

Copy link
Copy Markdown
Member

The failures are unrelated, can merge

@PedroTadim
PedroTadim merged commit 4419c07 into 26.3 Sep 11, 2026
33 of 38 checks passed
@PedroTadim
PedroTadim deleted the backport/26.3/109212 branch September 11, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants