[FEATURE REQUEST] Run garbage collection on cached git repos #67390
Replies: 4 comments
-
There's also a lot of obsolete entries in |
Beta Was this translation helpful? Give feedback.
-
It's a valid feature request. |
Beta Was this translation helpful? Give feedback.
-
We frequently have these directories eating up to 20GB disk space (which was already increase from 10GB), it seems to grow continuously if not cleaned up. Thanks for the tip about |
Beta Was this translation helpful? Give feedback.
-
We have observed in our environment that the git garbage collector does clear up some disk space, but the salt master keeps some file handles open indefinitely. This leads to a slow creep of zombie files that are nominally deleted, but are actually still allocated on the disk. The only solution we found was regularly restarting the salt master. Has anyone experienced something similar and/or an alternative solution? |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
When using gitfs and git_pillar, the cached repos will grow as more changes are pulled, but storage is never optimised and unreachable commits are never removed,
Describe the solution you'd like
Runner function(s) to run
git gc
on all cached repos, and ideally a built-in schedule to run it.It could be tied to existing pillar/filesystem refresh rather than a separate call.
Describe alternatives you've considered
Creating a periodic schedule to run
find /var/cache/salt/ -type d -name '.git' -exec git --git-dir '{}' gc \;
Additional context
I just saved over a GB of disk space doing this manually for the first time.
Beta Was this translation helpful? Give feedback.
All reactions