Repository navigation
Fix 04105_system_pause_view and 04319_system_stop_all_background when STOP reaches the server after the refresh finished - #127917
Conversation
… 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]>
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 (3 nits, none blocking).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261027-065300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261027-062200 |
|
cc @tuanpach, could you review this and add the |
|
Workflow [PR], commit [08593cc] Summary: ✅ AI ReviewSummaryPR #127917 reduces timing failures in Missing context / blind spots
Final VerdictStatus: ✅ Approve. No changes requested. |
ea4869c
… 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: #125034
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix rare failures of the tests
04105_system_pause_viewand04319_system_stop_all_backgroundwhere theSYSTEM STOPorSYSTEM CANCELof a refresh reached the server after that refresh had already finished.Description
Failing job: Stateless tests (amd_tsan, s3 storage, parallel, 3/3),
<3a: stop after pause cancels the refresh>printed10 0instead of0 1: the refresh completed with no exception.The STOP/CANCEL tests (04105 Tests 3 and 3a, 04319 Tests 2 and 3) start a 10-row x 1 s refresh, poll from a new client until it has read a row, then send the interrupting statement from another client (3a: a third one for
PAUSE). Nothing checks that the refresh is still running when the STOP is processed, so on a slow host the client start-ups can outlast it. On public amd_msan master runs the STOP already lands 1.1-3.3 s into the refresh. The engine is fine: a STOP processed before the result swap always cancels.As in Test 1 (#125034), the check
status = 'Running' and read_rows between 1 and 8and the interrupting statements now go in one client call.read_rowscounts the row being slept on, soread_rows <= 8leaves at least 2 s. If the check misses, the view is re-created, up to 10 times. The check result is a new reference line, so an all-miss is a labelled mismatch, and a STOP that does not interrupt still fails the0 1line.Validation:
sleep 11after the old poll: the reported10 0diffs (10 1for CANCEL).sleep 9in the first attempt: OK after 2 attempts; in every attempt: fails on the new line only.PAUSEinstead ofSTOP, or a no-op instead ofCANCEL: fails with10 0/10 1.-j 8), 10/10 on the CI amd_msan binary, all on the first attempt; the STOP lands 0.06-0.35 s into the refresh.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/127917]
Version info
26.11.1.855-master(included in26.11and later)