Repository navigation
Fix flaky test 05059_top_k_dynamic_filter_shares_prewhere on object storage - #123123
Algunenano merged 1 commit into
Conversation
…torage The third on/off comparison orders by `grp, rowNumberInBlock()`, which is not a total order: `rowNumberInBlock()` repeats across blocks, and with some block sizes two `grp = 0` rows tie at the LIMIT cut. On object storage the 13-mark part is read in two streams (the remote concurrency thresholds default to 0, so `min_marks_per_task = 8` splits it into marks 0-7 and 8-12), while on local disk it is read in one. Each stream takes its whole share as one task, and a stream with nothing left takes the other stream's untaken share, so which of the tied rows survives depends on timing, independently in each arm. The top-K filter is not involved: it is refused because the expression below the sort computes the stateful `rowNumberInBlock()`. Failed on master in `Stateless tests (amd_tsan, s3 storage, parallel, 3/3)` at 852f246. Pin `max_threads = 1` on both arms of that comparison so it is read in one stream on every storage. A build without the refusal for a block-dependent expression still makes the pinned comparison return 0 at `max_block_size` 8000, 29226 and 50000. 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; 1 full pass).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20260930-180700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20260930-161100 |
|
Workflow [PR], commit [39bd869] Summary: ✅ AI ReviewSummaryThis PR makes the flaky Final VerdictStatus: ✅ Approve |
Related: #117968
Related: #122671
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
The third on/off comparison of
05059_top_k_dynamic_filter_shares_prewherefailed on master inStateless tests (amd_tsan, s3 storage, parallel, 3/3)(report): reference line 9 expected1, got0.That check compares
ORDER BY grp, rowNumberInBlock() LIMIT 20withuse_top_k_dynamic_filteringoff and on. The sort key is not unique:rowNumberInBlock()repeats across blocks, and with the failing run's settings twogrp = 0rows tie exactly at the LIMIT cut. On object storage the part is read in two streams (the remote concurrency thresholds default to 0), on local disk in one. The two tied rows are in different streams' shares, and a stream with nothing left takes the other stream's untaken share, so which row is kept depends on timing, in each arm separately. The filter is not involved: it is refused for this query andEXPLAINshows no__topKFilter.The fix adds
max_threads = 1to both arms of that one check, so it is read in one stream on every storage, as local disk already does. The other on/off checks sort by a unique key and are unchanged.Validation, on an S3 table (MinIO) in
clickhouse localwith the failing run's settings and ThreadFuzzer lock delays: the old check returned014 times in 150, and 18 times in 150 with the filter off in both arms. The fixed check returned1300/300 under the same delays and 500/500 without them. With the planner's refusal for this sort expression deleted, the fixed check returns0atmax_block_size8000, 29226 and 50000 on both disks, so it still catches the filter. The test passes 50/50 with randomized settings on a local-disk server and 50/50 on an S3-default server.Workflow [PR]
Sync PR [sync-upstream/pr/123123]
Version info
26.10.1.1157-master(included in26.10and later)