git/odb
Patrick Steinhardt 4e00f13e7e odb/files: be less aggressive with geometric repacking
When performing auto-maintenance with geometric repacking we have two
conditions that may trigger a repack:

  - Either the geometric sequence of packfiles is invalidated.

  - Or we have too many loose objects.

The first condition shouldn't trigger all that often: it may be hit when
we fetch a new packfile, but users tend to not do that all the time. The
second condition is what typically triggers more regularly though, as
every command that ends up writing new objects may cause us to cross the
threshold of loose objects. It is thus preferable to not be too
aggressive here, as otherwise we may end up repacking objects quite
often.

For the geometric-repacking strategy though we have a default of 100
objects, only. As we're approximating the count of objects by only
reading the "objects/17/" shared, we'd only need 2 objects in there
before we perform a repack by default, which is quite aggressive.
git-gc(1) on the other hand has a default of 6700, so it is quite a bit
more conservative here.

Being this aggressive is also causing problems as reported by our users.
When running lots of concurrent writers, those writes will constantly
end up spawning maintenance jobs that end up repacking objects. As we
also prune objects, a concurrently running process that tries to write
an object may see that the sharding directories get removed under their
feet. While we try re-creating such leading directories, we only do so a
single time, and it may happen that the directory vanishes again before
we had the chance to create the loose object. This is not a new problem,
but it is exacerbated by us running maintenance this aggressively.

Improve the status quo by reducing the frequency at which we pack loose
objects to the same frequency that git-gc(1) uses.

Reported-by: Stefan Haller <lists@haller-berlin.de>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-08-21 10:19:14 -07:00
..
source-files.c odb/files: be less aggressive with geometric repacking 2026-08-21 10:19:14 -07:00
source-files.h Merge branch 'ps/odb-make-creation-pluggable' 2026-08-20 07:30:52 -07:00
source-inmemory.c Merge branch 'jt/receive-pack-use-odb-transactions' 2026-07-22 10:30:53 -07:00
source-inmemory.h odb/source: introduce function to map source type to name 2026-08-06 21:24:25 -07:00
source-loose.c Merge branch 'ps/odb-make-creation-pluggable' 2026-08-20 07:30:52 -07:00
source-loose.h odb/source: introduce function to map source type to name 2026-08-06 21:24:25 -07:00
source-packed.c Merge branch 'ps/odb-move-loose-object-writing' 2026-07-30 10:32:05 -07:00
source-packed.h odb/source: introduce function to map source type to name 2026-08-06 21:24:25 -07:00
source.c odb/source: introduce function to map source type to name 2026-08-06 21:24:25 -07:00
source.h Merge branch 'ps/odb-make-creation-pluggable' 2026-08-20 07:30:52 -07:00
streaming.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
streaming.h Merge branch 'ps/odb-in-memory' into ps/odb-source-loose 2026-05-21 22:34:55 +09:00
transaction.c odb/transaction: introduce ODB transaction flags 2026-07-10 13:21:53 -07:00
transaction.h odb/transaction: introduce ODB transaction flags 2026-07-10 13:21:53 -07:00