Skip to content

fix: distinguish completed and unresumable backup files - #694

Open
ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:fix/backup-completion-sentinel
Open

ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:fix/backup-completion-sentinel

Conversation

@ivanauth

Copy link
Copy Markdown
Contributor

Summary

OcfFileEncoder.Cursor() inferred "completed" from a missing .lock, but .lock is only written on the first Append() — so a backup that crashed before the first relationship was misreported as completed and refused to resume.

Add a .done sentinel written on successful Close(). Cursor() now returns the cursor when .lock exists, ErrBackupAlreadyCompleted when only .done does, and ErrBackupUnresumable when neither. Close() writes .done before removing .lock. NewFileEncoder clears stale sidecars on fresh open.

@codecov-commenter

codecov-commenter commented May 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.27273% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/backupformat/encoder.go 77.27% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ivanauth
ivanauth force-pushed the fix/backup-completion-sentinel branch from 0dc6d91 to e456560 Compare August 6, 2026 18:51
@ivanauth
ivanauth force-pushed the fix/backup-completion-sentinel branch from e456560 to 6b7ac81 Compare November 2, 2026 20:58
Cursor() inferred "completed" from a missing .lock, but .lock is
only written on the first Append — so a backup that crashed before
the first relationship was misreported as completed and refused to
resume.

Add a .done sentinel written on successful Close. Cursor returns the
cursor when .lock exists, ErrBackupAlreadyCompleted when only .done
does, ErrBackupUnresumable when neither. Close writes .done before
removing .lock. NewFileEncoder clears stale sidecars on fresh open.
@ivanauth
ivanauth force-pushed the fix/backup-completion-sentinel branch from 6b7ac81 to 0c08a68 Compare December 4, 2026 17:36
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.

2 participants