Skip to content

Split the mixed ALTER in 05258_text_index_low_cardinality_dictionary so it runs in a Replicated database - #124109

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-05258-text-index-lc-dbreplicated
Oct 7, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-05258-text-index-lc-dbreplicated

Conversation

@groeneai

@groeneai groeneai commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

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

Related: #122409

05258_text_index_low_cardinality_dictionary (added by #122409) fails on every run of the DBReplicated lane. Line 41, ALTER TABLE tab CLEAR INDEX idx_lc, MATERIALIZE INDEX idx_lc, mixes an alter command with a mutation command, and a Replicated database refuses that: Code: 392 ... For Replicated databases it's not allowed to execute ALTERs of different types in single query. The job usually still reads OK because the reproducibility rerun passes outside the lane (Failed 0 out of 3 reruns): since #122409 merged, every row of Stateless tests (amd_llvm_coverage, s3 storage, DBReplicated, parallel, 1/3) (108 by 2026-10-05 22:45 UTC) carries this error and none passed on the first try. It surfaced as a failure on #119181.

The statement is split into CLEAR INDEX and MATERIALIZE INDEX, each with mutations_sync = 2. Outside a Replicated database the combined statement already ran as these two mutations in this order, so the test still rebuilds the cleared index and the reference is unchanged. The rest of the test now runs in the DBReplicated lane for the first time.

Validation on a one-node Replicated database with embedded Keeper (--replicated-database): the unedited test fails with the CI error at line 41; the edited test passes, 20/20 with random settings; 50/50 randomized runs outside the lane.


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

Version info

  • Merged into: 26.10.1.1789-master (included in 26.10 and later)

`ALTER TABLE tab CLEAR INDEX idx_lc, MATERIALIZE INDEX idx_lc` combines an
alter command with a mutation command. A Replicated database refuses such a
query (`validateReplicatedDatabaseSegments`, Code 392 QUERY_IS_PROHIBITED), so
in the DBReplicated lane the client stopped at this line on every run and the
rest of the test never executed there. The failure was mostly hidden by the
reproducibility rerun, which passes outside the lane.

Run the two commands as separate statements, each with mutations_sync = 2.
Outside a Replicated database the combined statement already created these
two mutations in this order, so the test still rebuilds the cleared index and
the reference is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Oct 5, 2026
@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

My own cold review plus an independent model pass (codex, 0 findings). 1 finding in total.

# Sev Finding Verdict Evidence / action
1 💡 The MATERIALIZE INDEX section cannot tell a rebuilt index from one CLEAR INDEX never removed Noted, not blocking Already true of the combined statement; the split keeps the same two mutations in the same order

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-9:20261005-223400

@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. One-node Replicated database (embedded Keeper, CI database_replicated.xml), --replicated-database: fails every run with Code: 392 at line 41, as in CI.
b Root cause explained? CLEAR INDEX (alter) and MATERIALIZE INDEX (mutation) form two segments; validateReplicatedDatabaseSegments (InterpreterAlterQuery.cpp:285-292) refuses more than one.
c Fix matches root cause? Yes. Two single-segment ALTERs; no tag, setting or assertion change.
d Test intent preserved / new tests added? Preserved: the index is still cleared and rebuilt; reference byte-identical. Test-only, no new test.
e Both directions demonstrated? Yes, same binary: unedited FAIL, edited OK; 20/20 random settings under --replicated-database, 50/50 outside it.
f Fix is general across code paths? The other ALTERs in the file are single-segment; the other #122409 tests do not run with --replicated-database.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (one statement); the whole test passed 20/20 under --replicated-database.
h Backward compatible? (maintainer-approved exception only) N/A: test-only.
i Invariants and contracts preserved? Same two mutations in the same order (CLEAR, then MATERIALIZE), each with mutations_sync = 2.

Session id: cron:clickhouse-impl-slot-5:20261005-220100

@clickhouse-gh

clickhouse-gh Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [52cea10]

Summary: ✅


AI Review

Summary

This PR splits the mixed ALTER TABLE tab CLEAR INDEX idx_lc, MATERIALIZE INDEX idx_lc statement in tests/queries/0_stateless/05258_text_index_low_cardinality_dictionary.sql into two statements so the test can run under DatabaseReplicated, where mixed alter and mutation segments are rejected with QUERY_IS_PROHIBITED. I read the current diff, the surrounding test, and the existing PR discussion, and I do not see a correctness or coverage regression from the split: the test still clears and rebuilds the same index in the same order, and the change is appropriately scoped as a CI/test fix.

Final Verdict

✅ No blocking findings. I did not post inline review comments because I did not find any new issues that warrant them.

@alexey-milovidov alexey-milovidov self-assigned this Oct 7, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 7, 2026
Merged via the queue into ClickHouse:master with commit 7976ad9 Oct 7, 2026
149 of 150 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 7, 2026
@clickhouse-gh clickhouse-gh Bot added comp-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... 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-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... 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.

3 participants