Repository navigation
Make text index flush limits configurable - #111573
Conversation
|
Workflow [PR], commit [7bf7dc6] Summary: ✅
AI ReviewSummaryThis PR makes text-index temporary-segment flushing configurable and adds a memory-based flush estimate plus the Findings
Final Verdict
|
Force a Wide part explicitly so the regression needs only 1,024 rows instead of one million.\n\nhttps://github.com/ClickHouse/pull/111573
Isolate token-triggered flushing and give memory-triggered flushing enough allocation margin across sanitizer builds.\n\nhttps://github.com/ClickHouse/pull/111573
Preserve pre-26.7 token-only behavior when `compatibility` selects an older version.
Record the new `MergeTree` settings in 26.8 and use `tupleElement` in the regression test for old-analyzer compatibility. CI: ClickHouse#111573
The memory estimate of the text index builder is a thread memory tracker delta taken around `MergeTreeIndexAggregatorText::update`. Sanitizer builds link the sanitizer runtime's `operator new`, which replaces the tracking one from `AllocationInterceptors.cpp`, so `new` allocations are invisible to the tracker there. The previous workload - two rows holding one token - grew the builder only through `operator new`: the arena's first chunk and the token map are allocated in the aggregator constructor, before the measurement starts. The measured delta stayed zero, the threshold never triggered, and the mutation wrote one segment instead of several. Use 20000 distinct tokens so the builder grows through the arena and the token map. Those allocations go through `Allocator`, which reports to the memory tracker in every build. `max_block_size` is pinned so the threshold is evaluated on more than one block, and `index_granularity = 1` is dropped: that setting, not the row count, is what made the original million-row version of this test time out. Verified against the ASan and release builds of a982c5e from CI, 10 runs each, ~0.5s per run under ASan and ~0.2s under release. The 64 KiB threshold has about 32x of headroom - the test still passes with a 2 MiB threshold on both builds. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111573&sha=a982c5e591050c2033ee0ced870f9fcaa6f2b41f&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29 ClickHouse#111573
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 73/73 (100.00%) · Uncovered code |
|
📊 Cloud Performance Report ✅ AI verdict: This PR is scoped entirely to text-index construction during background merges and mutations (BuildTextIndexTransform flush thresholds plus two new merge-tree settings); it does not touch the query-execution path that ClickBench SELECTs use. ClickBench Q4 shows a -15.3% shift (243 ms vs 287 ms) but it falls within master's current variance band and was correctly suppressed as no_change — the changed code cannot plausibly speed up that query, so treat it as run-to-run variance. No real regressions or improvements are attributable to this change. clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
Allow text index builders to flush temporary segments based on configurable token and estimated memory thresholds. The new
MergeTreesettingstext_index_max_processed_tokens_before_flushandtext_index_max_memory_usage_before_flushreplace the hard-coded token threshold and reduce retained builder memory while materializing text indexes.Memory is estimated from the current thread's tracked allocation delta around each processed block. This accounts for posting lists and position data without traversing the text-index structures. The memory threshold is a soft flush trigger evaluated after each block; it does not bound total mutation memory. The
TextIndexTemporarySegmentsWrittenprofile event makes threshold-triggered flushing observable.Negative error below means that the estimate undercounted tracked retained memory:
The materialization benchmark used five local runs per implementation with 1M position-bearing rows and a 1 MiB flush threshold. CPU covers the complete
MATERIALIZE INDEXmutation, including temporary-segment merging:No CPU regression was observed despite correctly producing additional temporary segments.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Added the
text_index_max_processed_tokens_before_flushandtext_index_max_memory_usage_before_flushsettings to control when text index builders flush temporary segments.Version info
26.8.1.275(included in26.8and later)