Skip to content

Antalya 25.8 Backport of #93663 - Fix trash in TokenExtractor - #2673

Merged
zvonand merged 3 commits into
antalya-25.8from
backports/antalya-25.8/93663
Oct 27, 2026
Merged

zvonand merged 3 commits into
antalya-25.8from
backports/antalya-25.8/93663

Conversation

@zvonand

@zvonand zvonand commented Oct 25, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Critical Bug Fix (crash, data loss, RBAC) or LOGICAL_ERROR

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

The usage of ngram_bf index on a non-UTF-8 data led to an uninitialized memory read, with values that could reside in the resulting index structure. Closes ClickHouse#92576. (ClickHouse#93663 by @alexey-milovidov)

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

…rator

Fix trash in `TokenExtractor`

Conflicts committed as-is; the next commit resolves them:
- src/Interpreters/ITokenExtractor.cpp (both modified)
@zvonand

zvonand commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

Backporter: cherry-pick conflicts resolved by AI

Conflicted files:

  • src/Interpreters/ITokenExtractor.cpp (both modified)

Commits:

  • 02e7c8a: cherry-pick with the conflicts committed as-is

  • 60a5949: resolution

  • NgramTokenExtractor::nextInString / nextInStringLike: these conflicted because on 25.8, pos, token_start and token_length are pointers, while upstream they are references. I applied the fixes with dereferences: *token_length = std::min(*token_length, length - *token_start), ++i; *pos = i;, and the i + j < length bound in the UTF-8 copy loop.

  • DefaultTokenExtractor::nextInStringLike (upstream's SplitByNonAlphaTokenExtractor): same pointer/reference conflict. I added the *pos < length bound to the copy loop.

  • NoOpTokenExtractor::nextInStringLike: the conflicting block brought in the whole upstream SparseGramsTokenExtractor implementation, which doesn't exist on 25.8. I kept the 25.8 version (the NoOpTokenExtractor exception message) and dropped that class.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [4574c5c]

@zvonand

zvonand commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

Backporter: CI failures at 60a5949

Failed checks:

Needs a human: The conflict-resolution commit accidentally bumped 58 contrib submodule pointers, which breaks CMake; resetting the gitlinks in the index to the merge base was denied, and git add would restage the wrong commits.

  • Fast test (CMake configuration): caused by the PR. Commit 60a59494c7d moved 58 contrib/* submodules (abseil-cpp, boost, jemalloc, llvm-project and others) to commits that don't match antalya-25.8's contrib cmake files, so source files are missing. The fix is to restore those gitlinks to the merge base b989f10f852; I couldn't because index changes were denied.
  • GrypeScanServer, GrypeScanServer (-alpine), GrypeScanKeeper and FinishCIReport: no details in the reports; most likely knock-on failures because the build didn't produce images. They should clear once the submodules are restored.
  • The actual backport changes (src/Interpreters/ITokenExtractor.cpp and the new test 03784_msan_token_iterator) read correctly for 25.8's pointer-based API.
  • No files were changed or staged.

Rewrote the PR's bounds checks for 25.8's pointer-based extractor API (`size_t *` instead of `size_t &`); left out the `SparseGramsTokenExtractor` hunk because that class doesn't exist on 25.8.
@zvonand
zvonand force-pushed the backports/antalya-25.8/93663 branch from 60a5949 to ceb6cd5 Compare October 26, 2026 16:25
Added explicit `ENGINE = MergeTree ORDER BY ()` to the table in 03784_msan_token_iterator, since antalya-25.8 requires an ORDER BY / PRIMARY KEY by default
@zvonand

zvonand commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

@blau-ai

@blau-ai

blau-ai commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

CI triage for #2673 (head 4574c5c)

Verdict: neither failure comes from this backport's code. There are 2 real red checks: DCO, which is about commit metadata, and 1 stateless test, which is a known flake. The PR check is just the summary of the other checks. Every other check passed. That includes the builds, ~7700 stateless tests in the failing job, the rest of the stateless and integration suites, and the regression suites. Those results are good evidence the TokenExtractor fix itself is fine.

The PR touches only src/Interpreters/ITokenExtractor.cpp plus the new test 03784_msan_token_iterator. The new test passed.


1. DCO — ❌ → commit metadata only, needs the author

None of the three commits has a Signed-off-by: line. That includes the two non-merge commits ceb6cd5 ("Resolve conflicts in backport of ClickHouse#93663") and 4574c5c ("Fix CI failures (Fast test)").
Fix: do one of these:

  • Add a sign-off by rewriting history: git rebase --signoff, then git push --force-with-lease. I can't do this myself because force-pushing is outside my permissions.
  • Use the DCO app's override, as is usually done for backports.

2. Stateless tests (amd_binary, old analyzer, s3 storage, DatabaseReplicated, parallel) — ❌ → flaky, not caused by this PR

1 test failed out of 7704: 03608_export_merge_tree_part_filename_pattern. The rows from the third export (the "Pattern with macros" step) were missing:

 ---- Test: Pattern with macros
-1	2020
-2	2020
-3	2020
 ---- Verify macros expanded ...
 1
  • Cause: the test races with the export. ALTER TABLE ... EXPORT PART runs in the background, and the test does a fixed sleep 3 before reading the S3 table (test L43-45). On a slow job (s3 storage + DatabaseReplicated + parallel), the export hadn't finished within 3 seconds. The check that follows (count() = 0 ... WHERE _file LIKE '%{%') also passes when no files exist, so it still printed 1.
  • Why it isn't this PR: the test exercises Altinity's export-part feature, which has nothing to do with ITokenExtractor. The same test failed the same way on the unrelated backport Antalya 25.8 Backport of #85535 - Optimize selection of part list during query planning #2640, in a different configuration (amd_debug, parallel): triage.
  • Next step: this is safe to re-run or ignore for this PR. A separate fix for the test would be to poll until the export finishes instead of sleeping, for example wait until system.exports is empty or SELECT count() on the destination reaches the expected value with a timeout, and then assert. That change should go in its own PR, not this backport.

Report: result_pr.json

@zvonand
zvonand merged commit 3bf7197 into antalya-25.8 Oct 27, 2026
240 of 243 checks passed
@zvonand zvonand added the verified Approved for release label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants