Repository navigation
Fix flaky test 05829_read_by_layers_reads_only_key_prefix - #133653
Algunenano merged 1 commit into
Conversation
The measured merge join loads the column statistics of the table on a statistics cache miss, and the compressed bytes of that load count in `ReadCompressedBytes`, which the test compares with a tenth of the compressed size of `s`. The `EXPLAIN PIPELINE` before the join normally warms the statistics cache. A concurrent test that drops a table in an `Ordinary` database empties the server-wide caches in between (`MergeTreeData::dropAllData` calls `Context::clearCaches` for a table without a UUID), so the join loads the statistics again. With the randomized `uniq` statistic (about 408 KB here) and the randomized server codec `ZSTD(1)` (threshold about 326 KB) the oracle prints 0. The read itself is unchanged. Create the table without statistics, so the measured queries count only their column reads. Related: ClickHouse#132720, ClickHouse#119664 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; 1 finding) plus my own review of the diff (1 finding).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261123-023200 |
|
cc @Algunenano, could you review this? It sets auto_statistics_types = '' on the table of 05829_read_by_layers_reads_only_key_prefix (added in #132720): a concurrent Ordinary database drop cleared the statistics cache between the EXPLAIN and the measured join, so the join reloaded the randomized column statistics and their compressed bytes broke the ReadCompressedBytes threshold. The read itself is unchanged. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261123-021400 |
|
Workflow [PR], commit [8b37792] Summary: ✅ AI ReviewSummaryThe PR disables automatic column statistics on Final VerdictStatus: ✅ Approve |
d374f96
Related: #132720
Related: #119664
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required.
Description
05829_read_by_layers_reads_only_key_prefix(added in #132720) printed05829_join 0in Stateless tests (arm_asan_ubsan, targeted) on #119664: the measured merge join hadReadCompressedBytes426184, while the 41 other runs of the test in that job had 17100 or 11924.The excess was the column statistics, not the read:
SelectedMarks,read_rowsandread_bytesequal the passing runs, and the join hadStatisticsCacheMisses 2. TheEXPLAIN PIPELINEbefore it normally loads the statistics, so the measured join hits the statistics cache. Here the concurrent05081_ill_typed_skip_index_expression_attach.shdropped anENGINE = Ordinarydatabase in between; for a table without a UUIDMergeTreeData::dropAllDatacallsContext::clearCaches, which empties the server-wide statistics and mark caches, so the join loaded the statistics again. The randomizedauto_statistics_typesincludeduniq(about 408 KB of statistics), and the randomized server codecZSTD(1)puts the threshold at about 326 KB (about 597 KB withLZ4).The table is now created with
auto_statistics_types = '', so neither measured query has statistics to load. Test-only change, the reference is unchanged.Validation (master debug build, CI test configs with
ZSTD(1), the failing run's statistics types): withSYSTEM DROP STATISTICS CACHEor anOrdinarydatabase drop between theEXPLAINand the join, the unfixed test prints 0 in 5/5 runs and the fixed one 1 in 5/5. Randomized runs while a loop empties the statistics, mark and primary index caches about every 40 ms: 9/100 failed before, 0/250 after.Workflow [PR]
Sync PR [sync-upstream/pr/133653]
Version info
26.12.1.250-master(included in26.12and later)