Skip to content

housekeeping: Improvements for integration into the WAL

Karthik Nayak requested to merge 4736-housekeeping-prework into master

This MR is the first of three MRs for Clean up stale locks when applying WAL in Trans... (#4736 - closed).

Context: !5491 (comment 1315471897)
Will be followed by the MR: Draft: gitaly: Call `CleanStaleData` when there... (!5491 - closed)

To allow the TransactionManager to work with housekeeping package, we require two changes:

  1. Allow CleanStaleData to be configurable, so that we can only clean stale reference locks.
  2. Have locking logic to avoid conflicts between git-pack-refs(1) and stale reference lock cleanup

This MR tackles the second part of it.


housekeeping: Add logic to inhibit running git-pack-refs(1)

With the upcoming WAL (via TransactionManager), we need a way to inhibit running and cancel ongoing calls to git-pack-refs(1), while the TransactionManager is modifying refs.

This is because when git-pack-refs(1) is in progress, git would add locks to the refs which could block the TransactionManager from modifying the said refs. In short, the TransactionManager needs exclusivity to the refs for modification.

To facilitate this, packRefsIfNeeded now only runs if there are no inhibitors added and also provides a context cancellation facility. Both of which are provided via the repositoryState within the RepositoryManager. The repositoryState provides methods which allows users to add inhibitors for git-pack-refs(1) too.

The provided methods are internal to the package and can be easily exposed via the RepositoryManager when required.

Part of #4736 (closed)

Edited by Karthik Nayak

Merge request reports

Loading