Repository navigation
Fail CHECK TABLE that a shutdown aborted, instead of reporting broken data - #119381
Conversation
…en data A `ReplicatedMergeTree` replica that has lost its Keeper session enters partial shutdown, and `checkDataNext` then throws `ABORTED` before reading anything. `TableCheckTask::checkNext` turned that into a check result with an empty part path and `is_passed = 0`, and marked the task finished, so the remaining parts were never looked at and `CHECK TABLE t SETTINGS check_query_single_value_result = 1` answered `0` - the value documented to mean that the check found an error in the data - on a table whose data is intact. Monitoring that alerts, quarantines or re-replicates on `0` fires on every Keeper flap; a few seconds earlier in the same outage the query correctly fails with `KEEPER_EXCEPTION`. Rethrow it, like every other retryable error at that catch site (`isRetryableException` already treats `ABORTED` as retryable; it was excluded explicitly). `CHECK TABLE` then fails with `ABORTED` and `Table shutdown was called`, which is what a check that could not run should say, and `0` keeps meaning that a part failed its data check. The new `check_table_inject_shutdown_abort` failpoint aborts the check the way a partial shutdown does, so the test does not have to take a Keeper session down. Closes: #115748
|
Workflow [PR], commit [0141460] Summary: ✅
AI ReviewSummaryThis PR fixes the two shutdown-triggered false-negative Findings
Final Verdict
LLVM Coverage ReportMeasured on commit 0141460.
Changed lines: Changed C/C++ lines covered: 37/40 (92.50%) · Uncovered code |
Build profile diff (arm_release)Commit See the job log for details. |
…tdown-abort-115748
The previous commit made `checkDataNext` rethrow the `ABORTED` it throws when
a shutdown is already in progress before the part check starts. A partial
shutdown also calls `part_check_thread.stop()`, which flips `need_stop` under
a part check that is already running. `checkPartImpl` then returned
`{success = false, "Checking part was cancelled"}` for a healthy part, and
`CHECK TABLE ... SETTINGS check_query_single_value_result = 1` still answered
`0` on intact data.
`checkPartAndFix` now takes `throw_if_cancelled`; the foreground `CHECK TABLE`
path passes it and gets `ABORTED`, which `isRetryableException` treats as
retryable, so the query fails instead of reporting broken data. The background
part check thread keeps dropping cancelled results silently.
The new `check_table_inject_part_check_cancelled` failpoint drives that branch
in the test, which is renumbered to the next free number, 05227.
`test_check_replicated_does_not_block_shutdown` accepted a `0` result while
Keeper was killed mid-check; that was exactly the false broken-data report this
PR removes, so the test now requires the query to fail with a Keeper error or
`ABORTED`.
Addresses the review thread on `StorageReplicatedMergeTree.cpp`.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
🕵 Unrelated failures in the last CI run:
@groeneai, investigate the upgrade-check failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119381&sha=d897f0cba3442e9ef871f9f6b8797a75e62c5faa&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The |
|
🕵 The upgrade-check failure in that run is the That exposure came from the upgrade check's own option generator. It drew What was still open is whether the same failure is reachable with master on both sides. I left that unproven in the route census on #110518. It is now proven, in the Merged already, for the join-bearing routes of the same message: #118084 (a replica re-orders a shipped join) and #119861 ( Nothing is in progress for the join-free route. I am taking it, and I will link the PR here. |
|
I traced the upgrade-check failure to its source. It is the parallel-replicas symptom of #112891, and my fix for that is already open: #114955. My earlier note here was wrong to say nothing is in progress, and wrong about the statement: it is not The failing statement, both on your run and on the one recurrence since #119406 ( From your job's own server log:
The same log shows the other half of #112891 directly: the followers selected 4/4 marks where the policy allows 2/4. #114955 replans the read on the executing server with that server's own policies, which restores the fixed column, so both sides derive the same coordination mode and the same stream id. The regression test currently on that branch cannot reach this shape, because its policy is a range on a non-key column and no in-order read is ever planned, so I am pinning this shape there as well. Two notes on scope. Your run aborted on the pre-upgrade |
`StorageReplicatedMergeTree::checkDataNext` checked the shutdown flags before pulling the next part, so the final call that only reports the end of the part list threw `ABORTED` if a partial shutdown began after every part was checked, turning a completed check into a failure. Check the flags only when there is a part to check. Also disable the fail points in `05227_check_table_shutdown_abort` explicitly (the style check requires it) and cover the empty table, whose check consists of that final call alone. Addresses the review comment about the end-of-list call in `checkDataNext`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119381&sha=a556bf3c7f156d611fdb0e282f674d7667fcb38b&name_0=PR Co-Authored-By: Claude Opus 5.5 <[email protected]>
The style check `failpoint_tests_are_isolated` requires tests that enable a failpoint to be kept out of the fast test. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119381&sha=644797474e9461e91774dcb4f3b8258a30c9a4c4&name_0=PR&name_1=Style%20check #119381 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119381&sha=d46a59af6c91e199a9fd5e5bacff15cdc94a2da6&name_0=PR&name_1=Upgrade%20check%20(amd_release) and provide a fix in a separate PR. If the fix is already in progress, link it here.
I merged the latest |
|
Same failure as on #119181, not caused by this PR. The STID differs (2002-2037 instead of 3562-39cd) only because the six frames between the exception and From the logs of this run (table
The fix is in progress: #122375 (yours, removes the rolled back empty parts in About the master hits of 2026-10-03:
|
|
🕵 Thanks, @groeneai. Agreed: the |
alexey-milovidov
left a comment
There was a problem hiding this comment.
Ok. Though the comment is not easy to read.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
CHECK TABLEon aReplicatedMergeTreereplica whose Keeper session was lost now fails withABORTEDinstead of returning0, which means that the check found broken data. Nothing was read in that case, so the healthy table was certified as broken.Documentation entry for user-facing changes
...
A
ReplicatedMergeTreereplica that has lost its Keeper session enters partial shutdown, andcheckDataNextthen throwsABORTEDbefore reading anything.TableCheckTask::checkNextturned that into a check result with an empty part path andis_passed = 0, and marked the task finished, so the remaining parts were never looked at andCHECK TABLE t SETTINGS check_query_single_value_result = 1answered0— the value documented to mean that the check found an error in the data — on a table whose data is intact. Monitoring that alerts, quarantines or re-replicates on0fires on every Keeper flap; a few seconds earlier in the same outage the query correctly fails withKEEPER_EXCEPTION.Rethrow it, like every other retryable error at that catch site (
isRetryableExceptionalready treatsABORTEDas retryable; it was excluded explicitly).CHECK TABLEthen fails withABORTEDandTable shutdown was called, which is what a check that could not run should say, and0keeps meaning that a part failed its data check.The same partial shutdown also calls
part_check_thread.stop(), which cancels a part check that is already running.ReplicatedMergeTreePartCheckThread::checkPartImplreturned that as{success = false, "Checking part was cancelled"}for a healthy part, so the query still answered0in that window.checkPartAndFixnow takesthrow_if_cancelled; the foregroundCHECK TABLEpath passes it and getsABORTEDas well, while the background part check thread keeps dropping cancelled results silently.checkDataNextlooks at the shutdown flags only when there is a part left to check, so a shutdown that starts after the last part was checked does not turn the final end-of-list call into a failure.The new
check_table_inject_shutdown_abortandcheck_table_inject_part_check_cancelledfailpoints abort or cancel the check the way a partial shutdown does, so the test does not have to take a Keeper session down.New test:
05227_check_table_shutdown_abort, next to04506_check_table_retryable_zk_error, which covers the neighbouring window.test_check_replicated_does_not_block_shutdownaccepted the0result while Keeper was killed mid-check - the false broken-data report this change removes - and now requires the query to fail with a Keeper error orABORTED.Closes: #115748
Workflow [PR]
Sync PR [sync-upstream/pr/119381]
Version info
26.10.1.1723-master(included in26.10and later)