Skip to content

repository: Don't fail on concurrent deletions when calculating size

When calculating the repository size via filepath.WalkDir() it can happen that we are about to walk a directory that is concurrently getting removed. This can especially happen in the case where there is concurrent repository maintenance ongoing, which can end up removing e.g. empty object shards or reference directories.

This opens us up for a race where filepath.WalkDir() found out about any such directory, but then it's vanished before we had been able to read it. Instead of just skipping over the entry and thus handling it gracefully, we will return an Internal error whenever this race gets triggered.

Fix this bug by ignoring os.ErrNotExist errors.

Part of #4976 (closed).

Merge request reports