Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incomplete backups should not block delete or gc #170

Open
sourcefrog opened this issue Mar 20, 2022 · 0 comments
Open

incomplete backups should not block delete or gc #170

sourcefrog opened this issue Mar 20, 2022 · 0 comments

Comments

@sourcefrog
Copy link
Owner

Conserve 0.6.15 currently declines to delete or gc any content if the last band in the archive is incomplete:

conserve/src/gc_lock.rs

Lines 50 to 62 in 5320ad9

impl GarbageCollectionLock {
/// Lock this archive for garbage collection.
///
/// Returns `Err(Error::DeleteWithIncompleteBackup)` if the last
/// backup is incomplete.
pub fn new(archive: &Archive) -> Result<GarbageCollectionLock> {
let archive = archive.clone();
let band_id = archive.last_band_id()?;
if let Some(band_id) = band_id.clone() {
if !archive.band_is_closed(&band_id)? {
return Err(Error::DeleteWithIncompleteBackup { band_id });
}
}

https://github.com/sourcefrog/conserve/blob/main/doc/deletion.md

This is annoying in a couple of scenarios:

  1. If you discover the backup is including things that should be excluded, and you interrupt it, then you can't immediately remove the incomplete backup.
  2. Suppose the last backup is complete and the second-last is incomplete. If you delete the last backup, then you cannot then delete the incomplete backup.

Note that the policy does not just prevent deleting the last band; it prevents deleting anything if the last band is incomplete.

Basically, this is being used as a conservative detection of whether a backup might currently be underway.

The reason for this policy is that we want to make sure we're not writing a new backup concurrently with deleting data, which might lead to the new backup referencing blocks that are later deleted.

However this could possibly be handled another way, perhaps one of:

  1. Better indication whether a backup really is currently running. Possibly, the running backup should take a lock on the archive, not just gc.
  2. Deleting content in a way that is safe with a concurrent backup. (I'm not sure what that would be though.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant