Repository navigation
Keep 64-row granules in test 05316_top_k_primary_key_skip_query_condition_cache - #126583
alexey-milovidov merged 3 commits into
Conversation
…tion_cache The test asserts that the second `ORDER BY b LIMIT 5` read reads fewer rows than the first, thanks to the query condition cache. That needs a granule which the first read reads and the PREWHERE then empties: with 64-row granules every 1024-row group of `a` starts on a granule boundary, so the last granule of each group cannot be skipped by the primary key but has no row within the top-K threshold (4032 rows, then 2048). A random `index_granularity_bytes = 1538` sizes granules by bytes to 53 rows. Since 1024 % 53 != 0, each such granule also holds the next group's smallest `b`, every granule the first read reads has a qualifying row, and the cache, although it hits, has nothing to drop (1749 rows both times). Only release-build lanes can draw such a value. Clamp just that setting with `-- Random settings limits:` to at least 100000, which keeps adaptive granularity and the rest of the randomization. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review of the diff (0 findings). Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261018-114600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261018-113400 |
|
Workflow [PR], commit [1016381] Summary: ✅ AI ReviewSummaryThis PR clamps randomized Missing context / blind spots
Final VerdictStatus: ✅ Approve. No required changes. |
|
cc @alexey-milovidov, could you review this and add the |
Related: #125152
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
05316_top_k_primary_key_skip_query_condition_cacheprinted1 0instead of1 1(the repeated read was not cheaper) in arm_binary, AsyncInsert, s3 storage, sequential. The runner's own diagnosis: 179/179 failures with the same settings, 194/194 passes without them, culprit the random MergeTree settingindex_granularity_bytes = 1538. There is no GitHub issue for it.The test needs a granule that the first read reads and the PREWHERE then empties: that is what the query condition cache saves the second read. With 64-row granules every 1024-row group of
astarts on a granule boundary, so the last granule of each group is read (the primary key cannot boundbthere) and has no row within the top-K threshold: 4032 rows, then 2048. Withindex_granularity_bytes = 1538the granules are 53 rows and1024 % 53 != 0, so each such granule also holds the next group's smallestband nothing read can be dropped: 1749 rows both times, although the cache hits (QueryConditionCacheHits = 1,SelectedMarks618 -> 33). The engine behaves correctly: the test has not pinned the layout since c155740 droppedindex_granularity_bytes = 0.The test now clamps that one setting with
-- Random settings limits: index_granularity_bytes=(100000, None)(64-row granules need about 2 KB; the same clamp as01780_column_sparse_alter), and keeps the rest of the randomization. Test-only change, reference unchanged.Validation on a master debug build, with the runner's randomizer forced to draw
index_granularity_bytes = 1538: 10/10 failures with the CI diff before the change, 10/10 passes after it (system.query_logshows the clamped value in theCREATE). With the clamp line's prefix misspelled, lower values get through again. 50/50 randomized runs pass.Workflow [PR]
Sync PR [sync-upstream/pr/126583]
Version info
26.11.1.208-master(included in26.11and later)