WIP: Disk based cache for info-refs
Part of #1631 (closed)
Spin off of !1255 (comment 174678258)
Some additional concerns from the original !1255 (closed) I need to address:
- In some NFS deployments, there may be many Gitaly nodes serving the same storage locations. A db-per-process won't work since multiple processes need to coordinate access to the same repositories.
- This WIP uses boltDB to manage locking and unlocking of records. We should reference usage of boltdb in NFS environments for extra warm and fuzzies.
- BoltDB serializes write and blocks new readers. This DB should be limited to a repository (which is already a bottle neck for write operations since Git does file locking). Additionally, both read/write operations should open and close the repo as needed for each cache operation. Only one reader can open it for write operations at a time.
- Caches should reside in the special directory for ephemeral files: !1255 (comment 174312865)
- A potential file path per DB convention:
${INFO_REF_CACHE}/v1/${REPO_HASH}/db.bbolt
- A potential file path per DB convention:
- Cache should self-destruct after so much usage to prevent growing out of control. Use boltdb stats to decide whether to truncate file or continue to grow: !1255 (comment 172318281)
- Cache should have a feature flag to turn on and off function via gRPC metadata.
Edited by Paul Okstad (ex-GitLab)