Skip to content

Backport #115222 to 26.6: Bound text index posting list deserialization - #116535

Merged
CurtizJ merged 2 commits into
26.6from
backport/26.6/115222
Aug 29, 2026
Merged

CurtizJ merged 2 commits into
26.6from
backport/26.6/115222

Conversation

@robot-clickhouse-ci-2

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #115222
Cherry-pick pull-request #116310

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.6.4.47

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 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 Aug 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [4b704f7]

Summary: ❌

job_name test_name status info comment
Stress test (amd_tsan) FAIL
Hung check failed, possible deadlock found FAIL cidb
Cannot start clickhouse-server FAIL cidb
Check failed FAIL cidb

@CurtizJ

CurtizJ commented Aug 26, 2026

Copy link
Copy Markdown
Member

@groeneai fix CI in this backport

@groeneai

Copy link
Copy Markdown
Collaborator

The Unit tests red is the rewritten gtest, and it is a one-line fix.

makeSerialization() passes nullptr, but the constructor is chassert(posting_list_codec) (MergeTreeIndexText.cpp:152 here, :218 on 26.7), so the very first decodePostingsInPlace aborts inside the constructor, before deserialize is reached. That is why the log shows [ RUN ] TextIndexPostingsDeserializationTest.RoundTrip followed by a bare SIGABRT with no assertion text and no gtest.json, and why TruncatedPayloadRejected never runs at all. The comment above makeSerialization is right that deserialize does not consult the codec when IsCompressed is unset, but the constructor asserts before that. In release builds chassert is only an assumption, so every build check stays green.

-    return PostingsSerialization(nullptr, MergeTreeTextIndexSerializationVersion::V2_WithPositions);
+    return PostingsSerialization(std::make_unique<PostingListCodecNone>(), MergeTreeTextIndexSerializationVersion::V2_WithPositions);

and restore #include <Storages/MergeTree/MergeTreeIndexTextPostingListCodec.h>, which the rewrite dropped when it switched to MergeTreeIndexText.h. PostingListCodecNone is Type::None, and with header = 0 it is still never consulted, so coverage does not change. Master is green for the same reason: its version of the helper uses PostingListCodecNone directly and never constructs PostingsSerialization. The chassert on master is identical.

Worth knowing: the same file is now on 26.3 and 26.5 unvalidated. Unit tests is not a job in the BackportPR workflow on either (zero such check runs on #116533 and #116534), 26.3 has no Unit tests rows in CIDB at all over the last 30 days, and 26.5's have been failing at job level on -FunctionsStress since 2026-07-28. So this is not specific to 26.6 and 26.7; those are just the only two branches where the abort is observable.

The other red here, test_kafka_formats_with_broken_message, is pre-existing and branch-wide, not from this change: it fires on bare 26.6 and on 9 other backport/26.6/* branches in the last 14 days. Same for 02995_new_settings_history on #116536 (bare 26.7 plus 19 other backport/26.* branches).

I have no push access to backport/26.6/115222 (maintainerCanModify is false), so I will open a PR against that base with the change above, in the same shape as #114814, and the same for 26.7. Tell me if you would rather apply it directly.

@groeneai

Copy link
Copy Markdown
Collaborator

Opened #116640 for this.

One change from what I said earlier: it targets 26.6 directly rather than backport/26.6/115222.
Basing it on that branch would be a stacked pull request, which .claude/CLAUDE.md rules out and
which draws no checks (#116310, on that base, has none). So #116640 carries the whole backport and
supersedes this one. Closing this PR is yours to decide, and the one-line patch is still in my
comment above if you would rather apply it here instead.

The fix is test-only: the rewritten gtest built PostingsSerialization with a nullptr codec, and
the constructor asserts the codec is non-null, so RoundTrip aborted before deserialize was ever
entered. Passing a PostingListCodecNone fixes it and leaves the backported readSafe change alone.

The 26.7 equivalent will be linked on #116536.

@groeneai

Copy link
Copy Markdown
Collaborator

@CurtizJ Unit tests is still red here, and the cause is test-only. The cherry-picked
gtest_text_index_postings_deserialization.cpp passes nullptr as the codec into
PostingsSerialization, whose constructor ends in chassert(posting_list_codec)
(src/Storages/MergeTree/MergeTreeIndexText.cpp:152), so RoundTrip aborts inside the constructor
before deserialize is entered, and TruncatedPayloadRejected never runs at all.

The fix is the same two lines you merged for 26.7 in #116636:

@@ -6,6 +6,7 @@
  #include <Storages/MergeTree/MergeTreeIndexText.h>
 +#include <Storages/MergeTree/MergeTreeIndexTextPostingListCodec.h>
@@ -32,7 +33,7 @@
 -    return PostingsSerialization(nullptr, MergeTreeTextIndexSerializationVersion::V2_WithPositions);
 +    return PostingsSerialization(std::make_unique<PostingListCodecNone>(), MergeTreeTextIndexSerializationVersion::V2_WithPositions);

The file on this branch is byte-identical to the 26.7 pre-image (blob 259c13a73af4b58), so the patch
applies unchanged and produces the same post-image blob 9a7e7ca68b6e0b1. All four Unit tests legs
pass on #116536 at exactly that state. 26.3 and 26.5 need nothing: they carry the older
one-argument constructor, which has no chassert.

Correcting myself on one point above: I said that basing a pull request on backport/26.6/115222
would be a stacked pull request that .claude/CLAUDE.md rules out. The rule does say that, but it is
also the shape of #116636, which you merged; and a pull request based on 26.6 itself cannot carry
just these two lines, because the test file does not exist there yet. That is why #116640 ended up
carrying the whole cherry-pick.

How would you like the 26.6 half delivered? Either apply the two lines above directly, or confirm
that a pull request against backport/26.6/115222 is fine and I will open it exactly as I did for
26.7.

…serialization

`TextIndexPostingsDeserializationTest` constructed `PostingsSerialization`
with a null codec, but in 26.6 the constructor has `chassert(posting_list_codec)`,
so the test aborted in builds with sanitizers, where `chassert` is active
(on `master` the test goes through `PostingListCodecNone` directly and never
constructs `PostingsSerialization`). Pass the `None` codec instead: a posting
list without the `IsCompressed` flag never consults it, so the tested code
path is the same.

Unit tests (tsan): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=116535&sha=e71cd5c2e4bb1ed299b4fb5feaaf87db7a350d94&name_0=BackportPR&name_1=Unit%20tests%20%28tsan%29
Related: #116535
@CurtizJ
CurtizJ merged commit 93024cb into 26.6 Aug 29, 2026
37 of 40 checks passed
@CurtizJ
CurtizJ deleted the backport/26.6/115222 branch August 29, 2026 19:36
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.

4 participants