GC.writePack does not enable PackWriter searchForReuseTimeout and ObjectDirectory does not short-circuit alternate scans on timeout

未關閉
#309 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
半天
新手友好度
64/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
git, java
領域
devtools

研究方向

Start in GC.writePack, where the PackWriter is created, and check whether enableSearchForReuseTimeout() is called before repacking. Then read ObjectDirectory.selectObjectRepresentation, where the loop over myAlternates() runs after the local pack loop; add an early return when packer.checkSearchForReuseTimeout() is true. Done when GC.repack() honours pack.searchForReuseTimeout and a unit test shows alternates are skipped after the timeout trips. The author's proposed branch fix/gc-search-for-reuse-timeout can be compared against.

由索引模型根據 Issue 內容生成。

描述

Version

JGit 6.10.x / 7.x (master)

Operating System

Linux (x86_64)

Bug description

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:

  1. 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().
  2. 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
  1. 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.
  2. 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
  1. GC.writePack calls pw.enableSearchForReuseTimeout() so pack.searchForReuseTimeout is respected during GC.repack().
  2. 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): https://github.com/trukhinyuri/jgit/commit/6b55b1c8d9433a11530767692178f17cee4654c0 (branch fix/gc-search-for-reuse-timeout).

主要語言
Java
星號
427
分支
116
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

eclipse-jgit/jgit 的其他 Issue

查看 eclipse-jgit/jgit 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。