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

オープン
#309 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eclipse-jgit/jgit のほかの issue

eclipse-jgit/jgit の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。