Repository navigation
Fix "Too many marks" for text index on an empty merged part - #106867
Conversation
|
Workflow [PR], commit [7aebe09] Summary: ✅
AI ReviewSummaryThis PR fixes text-index mark serialization for merged or mutated parts that end with zero rows. The current code uses the final merged row count ( Missing context / blind spots
Final VerdictStatus: ✅ Approve |
When a merge produces a part with zero rows (for example when a lightweight delete removes everything), `MergeTextIndexesTask::executeStep` still wrote a single mark into the text index marks file "for compatibility with other skip indexes". But an empty part reports zero marks, so `getMarksCountForSkipIndex` returns 0, and reading the marks back (e.g. while prewarming the mark cache on attach with `prewarm_mark_cache`) failed with `Too many marks in file ... skp_idx_idx.cmrk2`. Regular skip indexes gate every mark/granule write on actually having data (`calculateAndSerializeSkipIndices` only writes inside the per-granule loop, `fillSkipIndicesChecksums` only serializes a granule when the aggregator is non-empty), so they naturally emit zero marks for an empty part. Make the text index merge task follow the same invariant: skip the mark when the resulting part has no marks, keeping the marks file consistent with `getMarksCountForSkipIndex`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The previous commit gated the text index mark on `new_data_part->index_granularity->getMarksCountWithoutFinal()`, but the `MergeTextIndexStage` runs before `MergeProjectionsStage` finalizes the part, so at that point `index_granularity` is still empty and the check returned zero for every part - the compatibility mark was skipped always, not only for empty parts. Pass the number of merged rows into `MergeTextIndexesTask` instead (`rows_written` from the merge / mutation context, which is final by this stage) and write the mark only when the resulting part is non-empty. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
b494b95 to
7aebe09
Compare
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 27/27 (100.00%) | Lost baseline coverage: none · Uncovered code |
|
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment. TL;DRFix "Too many marks" for text index on an empty merged part ClickGap verified: reproduced it with the script below on ReproductionBisect
Affects
Suggested next stepThe bisect boundary above narrows the search in Component: cc fix PR author: @azat ClickGap · Finding: Triage metadata |
|
Hi — this looks like a backport candidate for |
Cherry pick #106867 to 26.3: Fix "Too many marks" for text index on an empty merged part
Cherry pick #106867 to 26.4: Fix "Too many marks" for text index on an empty merged part
Cherry pick #106867 to 26.5: Fix "Too many marks" for text index on an empty merged part
Backport #106867 to 26.5: Fix "Too many marks" for text index on an empty merged part
Backport #106867 to 26.4: Fix "Too many marks" for text index on an empty merged part
Backport #106867 to 26.3: Fix "Too many marks" for text index on an empty merged part
…ty-part-marks Fix "Too many marks" for text index on an empty merged part
STOR: text index on an empty merged part -> exc Too many marks. Effect in the production build a394e92: wrong/failing (the upstream test fails on it and passes on official 26.8.8.8; evidence/fix_ci_20260925/upstream_repro/residual/106867.PROD263.txt). Upstream patch unchanged, with its test(s): 04326_text_index_empty_part_marks_prewarm. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a merge produces a part with zero rows (for example when a lightweight delete removes everything),
MergeTextIndexesTask::executeStepstill wrote a single mark into the text index marks file "for compatibility with other skip indexes". But an empty part reports zero marks, sogetMarksCountForSkipIndexreturns 0, and reading the marks back (e.g. while prewarming the mark cache on attach withprewarm_mark_cache) failed withToo many marks in file ... skp_idx_idx.cmrk2.Regular skip indexes gate every mark/granule write on actually having data (
calculateAndSerializeSkipIndicesonly writes inside the per-granule loop,fillSkipIndicesChecksumsonly serializes a granule when the aggregator is non-empty), so they naturally emit zero marks for an empty part. Make the text index merge task follow the same invariant: skip the mark when the resulting part has no marks, keeping the marks file consistent withgetMarksCountForSkipIndex.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix "Too many marks" for text index on an empty merged part
CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106808&sha=baf623fcb653414335f6588588111f272d4776ca&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29
Version info
26.6.1.114026.5.4.16,26.4.5.71,26.3.16.11