Skip to content

git/stats: Ignore disappearing files when counting loose references

Patrick Steinhardt requested to merge pks-git-stats-refcount-deletion-race into master

We have recently started to roll out a change into production systems that starts to calculate the repository size via RepositoryInfo() instead of the RepositorySize() RPC. As part of this rollout we have observed very infrequent cases where counting loose references has failed because files do not exist. This indicates that those references were concurrently deleted, which is perfectly fine and thus expected and thus we should handle this case gracefully.

Address this issue by ignoring os.ErrNotExist errors when counting loose references to make this code more robust.

Discovered in the context of [Feature Flag] Enable `recent_objects_for_proje... (gitlab#420125 - closed).

Merge request reports