Skip to content

retrying problematic files (borg2) #7346

Description

@ThomasWaldmann

Quite often, especially since borg 1.2 warns about "file changed while it was backed up", there was the wish for a "retry feature" for somehow "failed" files.

Error conditions the might be solvable by retrying:

  • file changed while we backed it up (file in use)
  • misc. OSError (like I/O errors) (sw or hw issues)
  • race conditions with the file type and the file inode number (due to an active fs)

Retrying wasn't easy to implement yet, but I recently made a change to master branch making it simpler:

https://github.com/borgbackup/borg/pull/7349/files - this basically cleans up content chunks incref'd (written) for a file that has been aborted due to an issue (BackupOSError).

In general, we have these scenarios:

  • problems before starting to write content chunks to the repo and before writing the file metadata item to the repo: no special cleanup needed, we could just retry.
  • problems while reading file contents (IOError == OSError, getting transformed into BackupOSError) and before writing the file metadata item to the repo - cleanup needed.
  • problems detected after finishing with backing up the file contents and before writing the file metadata item to the repo (e.g. when borg checks stat of the file again and notices that the file has changed while we read it).
  • problems detected after we wrote the file metadata item to the repo: too late, we can not abort that item any more, we could only abort the backup completely.

Note that if we run into troubles with a file (1st try), then clean up the repo from the content chunks, then do the 2nd attempt (1st retry), this might re-transfer content chunks to the repo (which we just had cleaned up). This could be optimized later.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions