Repository navigation
Revert some changes of "Revert "Revert "New functions isPrime and isProbablePrime""" - #104806
Conversation
|
Workflow [PR], commit [ced35d0] Summary: ✅ AI ReviewSummaryThis PR reverts the custom wide-integer Miller-Rabin implementation in Findings
Final Verdict
|
|
@groeneai 03823_optimize_dry_run_projections failure is unrelated. But why it fails? |
|
Hey @nihalzp — confirmed unrelated, here's why: The failure is a transient 180s timeout on The actual test logic completed — the four "parts before/after dry run" assertion blocks all match the reference. The failure is at line 27: SYSTEM FLUSH LOGS query_log; -- query 16, line 27 — timed out after 180s
Cross-PR scope (CIDB, 30 days): Zero master failures. Three PRs hit it:
Context — this is the same WasmEdge-timeout pattern Algunenano just flagged in #104866 ( Your PR is purely about reverting defensive checks on |
LLVM Coverage Report
Changed lines: 81.82% (36/44) | lost baseline coverage: 7 line(s) · Uncovered code |
0144a49
isProbablePrime on UInt128/UInt256 evaluated a whole block of rows inside one executeImpl call with no cancellation point. The pipeline samples cancellation only between blocks, so neither max_execution_time nor KILL QUERY could interrupt it, and each wide row costs milliseconds in boost::multiprecision::miller_rabin_test. Measured on master f9801d5, 10000 UInt256 rows at rounds = 64 against max_execution_time = 1: Code: 159. Timeout exceeded: elapsed 203157.095 ms, maximum: 1000 ms. 203x past its own deadline; the UInt128 carrier measured 382467 ms against the same deadline. Observed in CI as a Stress test (amd_msan) hung check with one query at elapsed = 1796 s, is_cancelled = 1 and max_execution_time = 10. The pre-existing rounds <= 256 cap already bounds a single call, so it does not help here: what was unbounded is the loop over the block. That is also why restoring the cancellable Miller-Rabin loop reverted in 736c7ee would not have fixed this - it would have added a checkpoint inside an already-bounded 82 ms call. Boost is retained, in line with the reasoning recorded on ClickHouse#104806. Primality.h takes an optional check_cancellation callback, invoked once per call just before the Miller-Rabin rounds, i.e. after the three cheap exits. The callback is opaque there, so Common stays free of ProcessList - the same split Base58.h already uses. isProbablePrime.cpp owns the query-status side via makeCancellationCheck and additionally charges a CancellationBudget per wide row, which bounds a block made only of cheap-exit rows (measured 0.04-0.26 us each) without making those rows pay for a check. Two mutation builds confirm both halves are load-bearing: with the callback removed the rounds cases overshoot again (203846 ms), and with the budget removed the cheap-exit case overshoots (10149 ms). The narrow path and the cheap exits are untouched and unslowed: 1M rows measured 3766 -> 3632 ms and 373 -> 360 ms, both within noise.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reverts some changes of #104633 and #104639. Both tried to fix the problem of query cancellation but had too defensive checks. Only limiting rounds to 256 is enough. See #104639 (comment).
Version info
26.5.1.657