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

fix: distinguish completed and unresumable backup files#694
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.

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.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.85185% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.97%. Comparing base (b0cdc17) to head (0dc6d91).

Files with missing lines Patch % Lines
pkg/backupformat/encoder.go 51.85% 8 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #694      +/-   ##
==========================================
+ Coverage   43.77%   43.97%   +0.20%     
==========================================
  Files          38       38              
  Lines        6193     6212      +19     
==========================================
+ Hits         2711     2732      +21     
+ Misses       3201     3195       -6     
- Partials      281      285       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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