Does Stash ever run Git GC proactively? Ideally, I would like Stash to run Git GC regularly during the night, to avoid it being triggered automatically by Git after a push in the middle of the workday. Is there some kind of mechanism for this? If yes, how do I configure when and how often the GC's should happen?
Bonus question: what happens when a Git GC is running and someone does a clone/pull?
Side note: I tried this plugin, the only thing it does is throw HTTP 405 errors.
For repositories that don't have forks we rely on git running auto gc on push. That doesn't necessarily mean git gc will actually run, git uses a heuristic to decide whether gc is necessary (the repository has either 6700 loose objects or 50 pack files. The number of loose objects is estimated by counting how many objects are in objects/17).
For forks we disable auto gc and run GC ourselves if necessary. We use a similar heuristic and also check when the last gc happened. This is also triggered by pushes but will run in the background.
Ideally, I would like Stash to run Git GC regularly during the night, to avoid it being triggered automatically by Git after a push in the middle of the workday. Is there some kind of mechanism for this?
Therefore there is no built in mechanism to schedule garbage collection. It'd be good if you could raise an issue (https://jira.atlassian.com/browse/STASH) that details why you want this and what problems you are currently experiencing that could be solved by this.
Bonus question: what happens when a Git GC is running and someone does a clone/pull?
Clones are not affected when git gc is being executed (but see below). Pack files are not being mutated, new pack file is being generated and gc deletes the old packs afterwards. Git relies on the Posix "delete on last close" semantics which in this case lets git delete unused packs without impacting clone operations that currently read from a pack file that was deleted so the clone can finish without problems.
With shared file storage this may potentially cause a problem as NFS doesn't give you proper "delete on last close" semantics across multiple NFS clients. So far that hasn't been an actual problem anyone has encountered, but we're pondering a number of potential solutions to address this if it ever becomes a problem.
Thanks for the detailed answer! What about pushes while the GC is running? I think they need to wait for the GC to be complete.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I created a Jira issue: https://jira.atlassian.com/browse/STASH-7102
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.