Repository navigation
Fix flaky tests 03632_skip_indices_logged and 04039_skip_index_query_log - #100984
Conversation
Two root causes for skip_indices being empty in query_log: 1. auto_statistics_types=minmax (randomized MergeTree setting) creates MinMax statistics that prune parts BEFORE skip indices evaluate. When statistics prune all parts, skip indices see 0 granules, drop 0, and nothing gets logged. Fix: pin auto_statistics_types='' in CREATE TABLE SETTINGS for all three tables. 2. use_skip_indexes_on_data_read=1 evaluates skip indices during data reading, but query_log.skip_indices only tracks indices evaluated during mark selection. Fix: change to use_skip_indexes_on_data_read=0 in test 03632 (test 04039 already used =0). Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Pre-PR Validation (session cron:clickhouse-ci-task-worker:20260328-051500) a) Deterministic repro? YES — b) Root cause explained? c) Fix matches root cause? YES — pinning d) Test intent preserved? YES — both tests verify skip index logging in e) Both directions demonstrated? YES — Without fix: 03632 fails deterministically (even without randomization), 04039 fails ~45% with randomization. With fix: both pass 50/50 with full randomization. |
|
cc @shankar-iyer — could you review this? It fixes the skip_indices query_log tests you may have seen failing: auto_statistics_types=minmax (randomized) prunes parts before skip indices evaluate, and use_skip_indexes_on_data_read=1 evaluates indices in a code path that doesn't log to query_log. |
|
Workflow [PR], commit [2475bb6] Summary: ✅ AI ReviewSummaryThis PR stabilizes two flaky stateless tests around ClickHouse Rules
Final Verdict
|
Changes look good. How much effort is required to log the skip indexes used into query_log when use_skip_indexes_on_data_read=1 ? You can check the code in MergeTreeIndexReadResultPool.cpp |
|
Thanks for the review! I looked into The effort is medium (~1-2 days):
Key files: This is a worthwhile enhancement but separate from this flaky test fix — happy to do it as a follow-up PR. |
2402f55
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Description
Fixes flaky tests
03632_skip_indices_logged_in_query_logand04039_skip_index_query_log_actually_appliedwhich verify thatquery_log.skip_indicesis populated correctly.Two root causes:
auto_statistics_types=minmax(randomized MergeTree setting) creates MinMax statistics that perform part-level pruning before skip indices can perform granule-level filtering. When statistics prune all parts, skip indices see 0 granules, drop 0, andskip_indicesstays empty.Fix: Pin
auto_statistics_types = ''inCREATE TABLE SETTINGSfor all tables in both tests.use_skip_indexes_on_data_read=1in test 03632 evaluates skip indices during data reading, butquery_log.skip_indicesonly tracks indices evaluated during mark selection (use_skip_indexes_on_data_read=0).Fix: Change to
use_skip_indexes_on_data_read=0in test 03632 (test 04039 already used=0). Update the.referencefile accordingly.Reproduction (root cause 1):
Reproduction (root cause 2):
Verified: 50/50 passes on both tests with full randomization (query + MergeTree settings).
🤖 Generated with Claude Code
Version info
26.4.1.348