Repository navigation
Conversation
…ut bytes The postings and positions files of a text index are not compressed, so the compressed-block sink never sees them and an index-dominated read was priced as almost nothing. A stream of uncompressed data now records the ranges of its file it consumed, closed by every seek and by every flush, and the text index reader counts them per file with the compressed blocks of the other readers, each range once. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t bytes `05871_autopr_input_bytes_text_index_postings`: a `hasPhrase` query over 1000000 rows reads 6562 bytes of positions. The statistics recorded 1949 input bytes before the previous commit and 40826 after it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dex-reads # Conflicts: # src/Storages/MergeTree/MergeTreeReaderStream.cpp # src/Storages/MergeTree/MergeTreeReaderStream.h # src/Storages/MergeTree/MergeTreeReaderTextIndex.h
… the limit The text index reader registers the ranges of its postings and positions files in one `ReadRangesRegistry::Batch`, like the other readers, and once the registry stopped, detaches the sinks of its streams and drops what it collected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [6f8e1b2] Summary: ❌
AI ReviewSummaryThe PR includes text-index postings and positions in the input-byte statistics used by automatic parallel replicas. Reviewed head Findings
Tests
Final VerdictStatus: Separate index-file identities from column-stream keys and cover the collision with a regression test. LLVM Coverage ReportMeasured on commit 6f8e1b2.
Changed lines: Changed C/C++ lines covered: 168/190 (88.42%) · Uncovered code |
…wStatisticsInputNanoseconds` Like the other readers, after the timer moved out of `ReadRangesRegistry`. The time of the fallback reader is counted by its own `registerReadRanges`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| return; | ||
| if (!file.read_ranges) | ||
| file.read_ranges = &read_ranges_registry->getReadRanges(fmt::format( | ||
| "{}/{}.{}", data_part_info_for_read->getDataPartStorage()->getFullPath(), index_read_task.index.index->getFileName(), kind)); |
There was a problem hiding this comment.
[Major] Keep text-index identities separate from column-stream keys
The registry is shared with MergeTreeReaderWide, which uses <part>/<stream_name> without the .bin extension as its key. In a wide part containing skp_idx_idx JSON(postings UInt64, positions UInt64) and a text index named idx, the JSON substreams are named skp_idx_idx.postings and skp_idx_idx.positions (see ISerialization::getFileNameForStream). These are exactly the keys constructed here for the separate .pst.idx and .pos.idx index files.
A query that reads those JSON fields while filtering through the text index therefore unions offsets from unrelated files. For example, data ranges [0, 1000) and index ranges [100, 200) are counted as 1000 bytes instead of 1100, underestimating the input used to choose parallel replicas. Please give index keys a namespace that cannot overlap column-stream keys, or use complete file identities consistently across readers, and add a focused regression for the collision.
AI review of a later commit does not approve the PR, see the AI Review comment.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes121 object files changed (+63.13 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units732 translation units recompiled, 5046 s compile time in total, 732 of them have a recent master baseline. |
The plan-based implementation cannot ship a read that uses direct read from a text index, so in the
job with `parallel_replicas_plan_based = 1` automatic parallel replicas skipped the query ("The plan built
with parallel replicas contains no read from the other replicas") and collected no statistics. The
same pin as in `02346_text_index_parallel_replicas`.
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133839&sha=8e1a7e8f7db9f63ef4f978287e88cd3474687071&name_0=PR&name_1=Stateless%20tests%20(arm_binary%2C%20ParallelReplicas%2C%20plan-based%2C%20s3%20storage%2C%20parallel)
Related: #133839
Related: #116360
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #127586
Related: #133777
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The input bytes automatic parallel replicas measure now include the postings and positions a query reads from a text index, so a query answered mostly by the index is no longer under-priced.
Stacked on #133777 (the limit on the registered ranges), which is stacked on #127586 (the input bytes measured as the compressed blocks the readers load); the base of this PR is the branch of #133777, so the diff shows only the text index reads.
The postings and positions files of a text index are written uncompressed (
MergeTreeIndexSubstream::isCompressed), so the compressed-block sink never saw them, and a direct read from the index was priced as almost nothing (on master too: there only theUInt8virtual columns were priced). AMergeTreeReaderStreamof uncompressed data now records the ranges of its file it consumed, closed by every seek and byrecordBytesConsumed, andMergeTreeReaderTextIndexregisters them per file inregisterReadRanges, in theReadRangesRegistrythe other readers share, each range once. Like the other readers, it registers them byReadRangesRegistry::Batch, and stops collecting them once the registry reachedautomatic_parallel_replicas_max_counted_ranges.Not counted: the files the index analysis reads itself (the sparse index, the dictionary and the postings it loads), and the posting lists served from the text index postings cache.
05871_autopr_input_bytes_text_index_postings: ahasPhrasequery over 1000000 rows reads 6562 bytes of positions. The statistics record 1949 input bytes without the change and 40826 with it.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/133839]