Repository navigation
Never delete an existing Distributed spool file during batch recovery - #118211
Conversation
`DistributedAsyncInsertBatch::recoverBatch` treated a twin in the `broken/` directory as proof that every file listed before it in `current_batch.txt` had been acknowledged, and finalized them with `markAsSend`. That inference only holds for servers with ordered split retries. The previous `sendSeparateFiles` skipped a file after a transient error and continued with the next one, so a server being upgraded can leave an unsent file in front of a quarantined one. Recovery then deleted rows that never reached any shard. Keep such files and let the normal queue resend them: the missing quarantined member already makes `recoverBatch` return `false`, and the surviving files are processed from `pending_files`. Duplicates are possible, data loss is not. The recovery test now models the pre-upgrade state and asserts that the unsent predecessor is delivered. Closes: #118153
|
Workflow [PR], commit [6f6e2cd] Summary: ✅
AI ReviewSummaryThis PR removes the recovery-time assumption that a Final Verdict✅ Approved LLVM Coverage ReportMeasured on commit 6f6e2cd.
Changed lines: Changed C/C++ lines covered: 2/2 (100.00%) · Uncovered code |
|
Hand-verified on the PR head: this fixes the loss direction of #118153 completely. The removed block was exactly the
On One backport note: the 26.8 / 26.6 backports of #117034 (#118141 / #118139) already merged with the deletion inference and without this fix, so they carry the loss window until #118211 is cherry-picked there too; #118138 (26.3) / #118140 (26.7) should land only together with it. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 9 s compile time in total, 7 of them have a recent master baseline. |
|
🕵 Thanks for the hand verification. Agreed on the mechanics: after the change On the backport note: 26.3 (#118138) carries this identical commit, and once this PR merges the |
|
TL;DR:
|
After #117034,
DistributedAsyncInsertBatch::recoverBatchtreated a same-named twin in thebroken/directory as proof that every file listed before it incurrent_batch.txthad already been acknowledged, and finalized those files withmarkAsSend, deleting them. That inference only holds for servers that already have ordered split retries. The previoussendSeparateFilesskipped a file after a transient error such asTOO_MANY_PARTSand continued with the next one, so a server being upgraded from any earlier release can leave an unsent file in front of a quarantined one. Recovery on the new binary then deleted rows that never reached any shard, silently.This change removes the inference. A still existing file listed before a quarantined twin is kept: the missing quarantined member already makes
recoverBatchreturnfalse, the stale batch file is dropped, and the surviving files are resent through the normal queue. Duplicates are possible in this edge case, data loss is not.The recovery integration test now models the pre-upgrade on-disk state and asserts that the unsent predecessor is delivered.
Closes: #118153
Related: #117034
Related: #118138
Related: #118141
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix silent data loss on upgrade in
Distributedbackground inserts withbackground_insert_split_batch_on_failure: batch recovery no longer deletes a spool file that was never sent when a later file of the same batch was quarantined intobroken/by a previous server version.Workflow [PR]
Sync PR [sync-upstream/pr/118211]