Skip to content

git/stats: Get rid of spawning git-count-objects(1)

Patrick Steinhardt requested to merge pks-git-stats-replace-object-count into master

This MR refactors the way we count loose objects and packfiles in repositories. Instead of spawning git-count-objects(1), we now do the accounting in Gitaly itself. While this forces us to get rid of two bits of information, it on the other hand allows us to easily extend whatever information we're deriving without doing the same work twice, once in Gitaly and once in git-count-objects(1).

This MR thus starts to derive some information we previously didn't have:

  • The number of stale objects and their size.
  • The number of garbage files, split up by loose objects and packfiles.

This information will thus be logged during repository maintenance.

Once !5093 (merged) lands, we'll expose some more information like info about commit-graphs and bitmaps. Together with this MR here it will allow us to count objects once and reuse the resulting struct both to perform both logging and make all decisions in our heuristical housekeeping strategy. Currently, we derive the relevant bits twice, which both leads to overhead and mismatches in reported information and the acted-on information.

Merge request reports