Repository navigation
Fix rare false failure of RANDOMIZE FOR check in 02932_refreshable_materialized_views_2 - #133657
Conversation
…terialized_views_2 Step 29 checked a single RANDOMIZE FOR draw with `next_refresh_time != expected`. Every finite next refresh time goes through `RefreshSchedule::addRandomSpread`, but `system.view_refreshes` reports `next_refresh_time` as a `DateTime`, so a drawn offset in [0, 1 s) prints as the unrandomized timeslot. With RANDOMIZE FOR 4 DAY 1 HOUR that is `r` in [-5, 5727] out of [-1e9, 1e9], i.e. 2.87e-6 per run; CIDB has 3 such failures since 2024-07 against ~3.5 expected. Create a second identical view `rmv_gg` and require every view to be inside the window and at least one of them off the timeslot. A missing spread still puts both views exactly at the timeslot, so the check still fails for that regression, while a chance false failure now needs two sub-second offsets (~8e-12 per run). The output lines and the reference are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eshable_materialized_views_2 `RANDOMIZE FOR` is centred on the timeslot: `RefreshSchedule::addRandomSpread` adds `spread * r / 2'000'000` ms with `r` in [-1e9, 1e9], so the offset is at most half the spread on either side. The step 29 window check allowed the full spread, so an offset of up to twice the documented window passed. The extreme draws give exactly +-174600 s, so the tighter bound never fails by chance. 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; 2 rounds: 2 findings, then 0 on the final head) plus my own review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261123-033600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261123-022600 |
|
Workflow [PR], commit [8f9f81b] Summary: ✅ AI ReviewSummaryPR #133657 reduces rare false failures in Final VerdictStatus: ✅ Approve |
c9994aa
Related: #118637
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted)on #118637 printed<29: randomize> 1 0:next_refresh_timeofrmv_g(RANDOMIZE FOR 4 DAY 1 HOUR) was exactly the unrandomized timeslot.The spread is applied: every finite next refresh time goes through
RefreshSchedule::addRandomSpread. Butsystem.view_refreshes.next_refresh_timeis aDateTime, so a drawn offset in [0, 1 s) prints as the timeslot. With this spread that is 5733 of the 2e9 + 1 possible draws, 2.87e-6 per run. CIDB has 3 such failures since 2024-07 (tsan, arm asan, amd asan) in about 1.04M runs, against about 3.5 expected.The change: step 29 creates a second identical view
rmv_gg. Every view must be inside the window, and at least one must be off the timeslot. The window check now allows half the spread on either side, asRANDOMIZE FORis centred on the timeslot; it allowed the full spread. A missing spread still leaves both views at the timeslot, so the check still fails; a false failure now needs both draws in [0, 1 s) (about 8e-12 per run). The output and the.referenceare unchanged.Validation on a local debug build: the old test with
RANDOMIZE FORremoved fromrmv_gprints<29: randomize> 1 0; the new test prints1 1with it removed fromrmv_gonly,1 0with it removed from both views, and1 0against a binary whoseaddRandomSpreadreturnswhenunchanged. 50/50 randomized runs pass. A binary that adds the full spread passes the old window check and fails the new one; the extreme draws-1e9and1e9pass it.Workflow [PR]
Sync PR [sync-upstream/pr/133657]
Version info
26.12.1.336-master(included in26.12and later)