You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GC.writePack does not enable PackWriter searchForReuseTimeout and ObjectDirectory does not short-circuit alternate scans on timeout #309
PackConfig supports pack.searchForReuseTimeout (DEFAULT_SEARCH_FOR_REUSE_TIMEOUT), and PackWriter enforces that timeout inside searchForReuse when enableSearchForReuseTimeout() has been called on the PackWriter instance.
However:
GC.writePack creates a PackWriter to repack a repository (all or nonHeads), where delta-base/object-representation reuse searches across many loose objects and non-bitmap packs are common, but never calls pw.enableSearchForReuseTimeout(). As a result, pack.searchForReuseTimeout has no effect during GC.repack().
In ObjectDirectory.selectObjectRepresentation(PackWriter, ProgressMonitor, Iterable<ObjectToPack>), after iterating local packs (for (Pack p : packList.packs)), the method unconditionally recurses into every AlternateHandle (for (AlternateHandle h : myAlternates())) even when packer.checkSearchForReuseTimeout() has already tripped.
Actual behavior
During GC.repack(), PackWriter.searchForReuse ignores pack.searchForReuseTimeout because searchForReuseTimeoutEnabled remains false. On repositories with thousands of non-bitmap packfiles or alternates, Finding sources during background GC can run for hours without bounding the reuse search phase.
When searchForReuseTimeout trips while scanning local packs, ObjectDirectory.selectObjectRepresentation still enters every alternate object database and starts another pack scan loop before noticing the timeout.
Expected behavior
GC.writePack calls pw.enableSearchForReuseTimeout() so pack.searchForReuseTimeout is respected during GC.repack().
ObjectDirectory.selectObjectRepresentation checks if (packer.checkSearchForReuseTimeout()) { return; } before traversing myAlternates().
Relevant log output
Finding sources: 14% (284120/2029428) [stalled in ObjectDirectory.selectObjectRepresentation across packList and alternates during GC.writePack]
Other information
Proposed fix and unit test (Commit: 6b55b1c): trukhinyuri@6b55b1c (branch fix/gc-search-for-reuse-timeout).
Activity
Enable PackWriter searchForReuseTimeout during GC and across alternates