Repository navigation
Fix 04105_system_pause_view and 04319_system_stop_all_background hanging when a poll misses the refresh - #125034
Conversation
…refresh Test 1 of both tests started a ~2 s refresh (2 rows * sleepEachRow(1), refresh every 1 year) and then polled for the transient `Running` state. When a poll stalls longer than the refresh (seen on master: one poll took 2.4 s on a loaded msan server and read `Scheduled`), the status stays `Scheduled` until the next refresh in a year, so the loop spins until the 600 s test timeout and SYSTEM PAUSE is never sent. Even passing msan runs paused only 62-310 ms before the refresh ended. Now the refresh is started in one client call and the pause is sent from a second one, which in the same call reads `status = 'Running' and (select count() from p) = 0`. `Running` after the pause means the refresh started before it (a paused view starts no new refresh), and an empty `p` means the replace-mode refresh had not swapped in its result yet. Otherwise the view is recreated and the step retried, at most 10 times; the result goes into the reference, so a slow server costs a retry or a labelled mismatch instead of a hang. 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 (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261010-041800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20261010-033500 |
|
Workflow [PR], commit [3d7d12d] Summary: ✅ AI ReviewSummaryThis PR replaces the unbounded Final Verdict
|
CI finish ledger - b1e1e82Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261010-073010 |
|
@groeneai merge master into this PR |
…w-poll-hang Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged master in 3d7d12d (clean merge, the PR's own change is unchanged). |
… STOP lands after the refresh The STOP/CANCEL tests relied on a 10-row x 1 s refresh outlasting the client start-ups between "the refresh started" and "the interrupting statement reaches the server": a poll client (wait_running_with_progress) and then a separate STOP client, plus a third PAUSE client in 3a. Nothing proved the refresh was still running when STOP was processed, so on a slow sanitizer host the refresh could finish first and the assertion read the completed state (`10 0` instead of `0 1`). Put the "still running" check and the interrupting statements in ONE client call, the shape ClickHouse#125034 used for Test 1: `status = 'Running' and read_rows between 1 and 8` (read_rows runs one row ahead of the 1 s transform, so <= 8 leaves ~2 s), followed on the same connection by STOP / PAUSE+STOP / CANCEL. If a slow server let the refresh get past row 8 before the check, the view is re-created and the attempt repeated (at most 10). The check result is printed as a new label line, so an environment where every attempt misses is a labelled mismatch rather than a silent pass, and a STOP that stops interrupting still fails the existing `0 1` line. wait_running_with_progress becomes unused and is removed from both files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the database disk on object storage `interrupt_running_refresh` checks `status = 'Running' and read_rows between 1 and 8` one client start-up after `SYSTEM REFRESH VIEW`. The refresh is already `Running` while it creates its target table, and with the database disk on object storage that takes seconds, so the check saw `read_rows = 0` and printed 0. Re-creating the view repeated the same timing, so all 10 attempts missed: `<3a: refresh running before stop: 0>` in `Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted)` (reported on ClickHouse#92472; there the check ran 0.4-0.6 s after the refresh started and the refresh INSERT 0.6-2.6 s after it). Wait until the refresh has read its first row, or failed, before the one-call check. A new view's `read_rows` keeps its value after the refresh, so the wait cannot miss it (no hang like the one ClickHouse#125034 fixed), and `clickhouse_test_time_left` bounds it. The `read_rows <= 8` check, the one-call statements and the retry from ClickHouse#127917 are unchanged, so a STOP that lands after the refresh is still retried and an all-miss is still a labelled mismatch. Validated on master 4944813 CI builds: with the database disk on MinIO and 10 ms injected latency each way, before 14/14 FAIL (release and asan_ubsan), after 56/56 and 42/42 OK, one attempt per helper call; a failpoint that holds the refresh before it reads fails before and passes after; 50/50 OK per test with random settings on a local disk and on the database disk. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #122921
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a rare 600 s timeout of the tests
04105_system_pause_viewand04319_system_stop_all_background.Description
Failing run on master: Stateless tests (amd_msan, parallel, 3/3),
Timeout!insidewait_status p Running.Test 1 starts a ~2 s refresh (
2 rows * sleepEachRow(1)) and then polls forRunning, which lasts only as long as that refresh. In the failing job the one poll issued during the refresh stalled 2.4 s on the server and readScheduled; after that the status staysScheduled(next refresh in 1 year), so the loop never ended andSYSTEM PAUSE VIEWwas never sent. In three green msan runs the pause landed only 62-310 ms before the refresh ended.Now the test starts the refresh, then pauses from a second client and reads
status = 'Running' and (select count() from p) = 0in the same call.Runningmeans the refresh started before the pause, and an emptypmeans it had not swapped in its result yet. Otherwise it recreates the view, up to 10 times, and prints the outcome into the reference, so a slow server costs a retry or a clear mismatch, never a hang.04319_system_stop_all_backgroundhas the same Test 1 and gets the same change. Tests 2/3 wait on 10 s refreshes and are unchanged.Validation on a debug build:
sleep 3before the old poll:Timeout!4/4 per test, no pause sent.sleep 3in the first attempt: OK after 2 attempts, 4/4 per test.sleep 3in every attempt: fails in 39 s on the new reference line, no hang.SYSTEM STOP VIEWinstead ofPAUSE: fails.-j 8, 1 attempt each; the status read ended at least 1.85 s before the refresh did.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125034]
Version info
26.11.1.132-master(included in26.11and later)