Does `restic check` fail while adding to repo?


Assume a process is adding to a restic repository repo, i.e. it adds files but does not delete or change existing files in repo. Assume furthermore that during the add, a restic check is running on repo.

Does restic check on repo fail or proceed?

The adding process could e.g. be a restic backup, or an rsync creating an off-site copy of repo.

Does it make a difference what type of process is adding?

Thank you for clarifying.

I’m guessing that the following case could cause trouble.

Rsync adding files to an off-site copy of a repo. While rsync is running, the off-site restic check starts.

It might be that rsync adds a ‘snapshot descriptor’ before adding its snapshot data (there is no way to tell rsync the order of files transferred, I’m assuming). In particular, rsync might add the snapshot descriptor before restic check starts, and does not add all snapshot data before restic check ends (assume slow connection to off-site). Then restic check tries to read snapshot data that has not arrived off-site yet. => restic check fails


restic check takes an exclusive lock on the repository, which blocks all concurrent operations. I would therefore conclude that any modifications to the repository could interfere with the check operation and cause it to fail – or at least give false positives when it checks partially-uploaded files.

You should not modify a repository while any exclusive lock exists. This can corrupt the repository and/or cause the command holding this lock to fail.