Repository navigation
Delay creating column readers with use_skip_indexes_on_data_read=1 - #107109
shankar-iyer wants to merge 3 commits into
Conversation
|
Workflow [PR], commit [23b23e5] Summary: ❌
AI ReviewSummaryThis PR delays PR Metadata
Tests
Final VerdictStatus: Minimum required actions: add the focused prefetched-pool regression test and update the PR changelog category/entry. |
|
@groeneai Can you review the PR description and then check the code changes ? Following should be handled with use_skip_indexes_on_data_read = 1 : 1) With normal read pool and with prefetch read pool, loading of column marks should start only after skip index filtering is complete. If the part is completely filtered out, no column marks should be loaded 2) With prefetch read pool, prefetching of column data should be enqueued only after skip index filtering is complete for a part and part has some ranges to read 3) skip index filtering should be executed concurrently on multiple parts 4) Prefetching should still be effective! |
|
@shankar-iyer Reviewed the description and the diff against your four requirements (read against master at c8a66ca). The approach is sound, and reqs (1) and (2) are correctly handled for both read pools. The one real concern is req (3) for the prefetch pool, which matches the clickhouse-gh bot note. (1) Column marks load only after skip-index filtering; a fully-filtered part loads no marks. OK for both pools. (2) Prefetch enqueued only after filtering, and only when the part has ranges to read. OK. (3) Skip-index filtering should run concurrently across parts. NOT met for the prefetch pool. The bot is right, and here is the asymmetry in detail:
Suggestion: reader creation in the prefetch path is already async ( (4) Prefetching still effective. Mostly OK, but gated by the (3) issue. Minor, non-blocking:
Happy to go deeper on the prefetch refactor if useful. |
|
@groeneai Can you implement (3) for the prefetch pool from your previous response ? |
|
@shankar-iyer Here is an implementation of (3) for the prefetch pool, following the approach from my previous review. It is localized to What it doesInstead of filtering every prefetch-eligible part inline inside
Three things worth calling out
Local validation (debug build, this PR head)
I did not run a TSAN build locally (time), so a ThreadSanitizer pass on the prefetch + skip-index path before merge would be worthwhile to confirm the concurrent warmup path is race-free. A Patch (apply with
|
|
@groeneai Check the above review comment : #107109 (comment) |
| const auto & top = prefetch_queue.top(); | ||
| createPrefetchedReadersForTask(*top.task); | ||
|
|
||
| if (pool_settings.defer_reader_creation) |
There was a problem hiding this comment.
This is the new path that enforces the PR's prefetch-pool contract for use_skip_indexes_on_data_read, but the PR does not add a deterministic regression test that forces MergeTreePrefetchedReadPool. The existing skip-index read tests can pass without exercising this branch, so a future change could again create column readers/prefetches for fully skipped parts, or serialize filtering before reads, without a stable test failure. Please add a focused test that enables the prefetched read pool, creates many parts where most are skipped by the index, and asserts via ProfileEvents such as RowsReadByMainReader / SelectedMarks that only selected parts load column marks and prefetch data.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 211/217 (97.24%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 6 line(s) · Uncovered code |
|
Dear @shankar-iyer, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Dear @shankar-iyer, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
Change : With
use_skip_indexes_on_data_read = 1, evaluate skip indexes before instantiatingMergeTreereaders so that fully filteredpartsdo not load column marks (or prefetch column data), while keeping skip index checks parallel across read threads.Note that the essential identity of
use_skip_indexes_on_data_read = 1is still maintained. Data read of a selectedpartwill begin immediately when it's skip index filtering is complete.Currently, take a case where PK filtering has resulted in 1000 parts and skip index filtering is deferred to read time with
use_skip_indexes_on_data_read = 1. The column readers of the 1000 parts will immediately start reading their marks etc and cause significant load on the thread pool / storage. Skip Index filtering may finally find only 20partsto be read.Changelog category (leave one):