Repository navigation
Retry a part load after an I/O error instead of detaching the part as broken - #127381
alexey-milovidov merged 4 commits into
Conversation
… broken At server startup and on ATTACH TABLE, one failed read (EIO) of a part metadata file (checksums.txt, columns.txt, count.txt, serialization.json, ...) made loadDataPart mark the part broken on the first attempt, so it was renamed to detached/broken-on-start_<name> and its rows disappeared from the table until manual repair. loadDataPart marks a part broken on any error that isRetryableException rejects, and EIO is rejected, so the retries of loadDataPartWithRetries never engaged. An I/O error (ErrnoException with EIO, or std::filesystem::filesystem_error with io_error from stat) is now rethrown by loadDataPart while attempts remain, so the existing three attempts absorb a transient error. On the last attempt the part is marked broken as before: a persistent error still detaches the part instead of failing the whole table load, which keeps the behaviour chosen in ClickHouse#49430. isRetryableException itself is not changed, because its other callers (readers, part check, fetch) must keep treating a persistent I/O error as a broken part. The "needs manual correction" log line is not printed for an I/O error. The regression test uses a new once-only failpoint that throws EIO while loading part metadata. It is tagged no-parallel, no-fasttest as required for failpoint tests by the style check. Closes ClickHouse#127233 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assert that the once-only failpoint `merge_tree_load_part_io_error` is spent after `ATTACH`, so the test goes red if the injection no longer reaches the part load path (it would otherwise still print 300 / 0). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (3 runs, 1 fix round)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261022-100400 |
|
cc @rschu1ze @hanfei1991, could you review this and add the |
|
Workflow [PR], commit [4dc04f6] Summary: ✅
AI ReviewSummaryThe PR retries transient Final VerdictStatus: ✅ Approve |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units251 translation units recompiled, 2887 s compile time in total, 251 of them have a recent master baseline. |
…t as corruption When `checksums.txt` of a part is missing or empty, `loadChecksums` recalculates the checksums with `checkDataPart`, which reads `serialization.json` again. Its `catch (...)` turned every error, including an `EIO` from the read, into `CORRUPTED_DATA`, so `loadDataPart` did not retry the load and detached the part as broken on the first transient I/O error. Rethrow I/O errors as is; anything else is still reported as `CORRUPTED_DATA`. The other callers of `checkDataPart` only distinguish retryable errors, and an `EIO` was not retryable before either, so their verdicts do not change. Validated locally with strace fault injection (part without `checksums.txt`, `EIO` on the second open of `serialization.json`): before, the part was detached as `broken-on-start` on the first attempt; after, the load is retried and the part keeps its 300 rows. A persistent error still detaches the part after 3 attempts, and an invalid `serialization.json` is still reported as `CORRUPTED_DATA`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #127233
Related: #114180
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a data part being detached as
broken-on-start(its rows disappearing from the table) after a single transient I/O error (EIO) while reading the part's metadata at server startup orATTACH TABLE. The load is now retried, and an I/O error marks the part broken only when the load has failed on all 3 attempts. Closes #127233.Description
On 26.9.19.9, one
EIOwhile readingchecksums.txtof a part at startup (strace fault injection, as in the issue) renames the part todetached/broken-on-start_all_1_1_0, andSELECT count()returns 0 instead of 300 with no error.loadDataPartmarks a part broken on any error thatisRetryableExceptionrejects, andEIOis rejected, soloadDataPartWithRetriesnever retries it. Now an I/O error (ErrnoExceptionwithEIO, orstd::filesystem::filesystem_errorwithio_errorfromstat) is rethrown while attempts remain, so the existing 3 attempts (shared with the other retryable errors) absorb a transient one; the last attempt marks the part broken as before, so a persistent error still detaches it and the server still starts.isRetryableExceptionis unchanged. Whenchecksums.txtis missing or empty,checkDataPartrecalculates it and readsserialization.jsonagain; it reported anEIOthere asCORRUPTED_DATAand now rethrows it, so that path is retried too.Validation, real syscalls with strace: one
EIOonchecksums.txt,columns.txt,count.txt,serialization.json(its read, or its second open withchecksums.txtremoved) or on astatof the part: master detaches the part, the fix keeps all 300 rows. A persistentEIOstill detaches the part after 3 attempts; a garbagechecksums.txtorserialization.jsonis still reported as corruption. The new test injects oneEIOwith a once-only failpoint, checks that it fired, and fails without the retry; the persistent and missing-checksums.txtcases are covered by the strace runs only.#114180 (open) proposes the same retry-then-mark-broken shape for an object store not-found on the same lines of
loadDataPart; whichever merges second is rebased.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/127381]
Version info
26.11.1.701-master(included in26.11and later)