Skip to content

Keep confirmed backup uploads and remove abandoned local files - #14652

Draft
mengxu-oai wants to merge 1 commit into
apple:mainfrom
mengxu-oai:codex/backup-writer-cleanup-main
Draft

mengxu-oai wants to merge 1 commit into
apple:mainfrom
mengxu-oai:codex/backup-writer-cleanup-main

Conversation

@mengxu-oai

Copy link
Copy Markdown
Contributor

A backup worker can write one tagged log batch to several destinations. If one finish fails, the worker currently opens fresh files for every destination, including files that already acknowledged the batch or still have a finish in flight. A failed or abandoned local writer can also leave its private .temp or .temp.part file on disk. This brings the corresponding changes from #14463 to main.

The worker retains each destination's finish result across retries. It releases a failed writer before opening its replacement and advances the saved versions once all active destinations acknowledge. Local writers keep the outstanding I/O alive until cleanup can safely remove their unique temporary paths. A failed publish leaves the prior destination intact.

This applies directly to main. #14435 also changes local file creation. If either PR rebases after the other lands, preserve both this cleanup and #14435's asynchronous parent-directory creation and atomic rename.

Validation

  • On macOS ARM64 with seed 271828, /backup/containers/localdir/ reported 25 passed and zero failed in both native and Sim2 modes. The forced rename-failure case exercises its assertions only on native filesystems. Both modes exercised abandoned files and independent encryption keys.
  • All seven /BackupWorker/MutationLogUpload/ cases passed both natively and in Sim2. The recipient test covers an acknowledged finish, a pending finish, two lost acknowledgements, a stopped backup and a newly started backup.
  • With the new regression tests linked against the original main implementations, native FailedRenameCleanup found a leftover .temp file, AbandonedWriteCleanup found a leftover private file, and ChangingRecipients completed while the original destination's finish was still pending. All three passed with the fix.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant