Skip to content

pack: single-pack reuse and tolerant MIDX bitmap verification - #108

Open
redhox wants to merge 1 commit into
tobi:mainfrom
redhox:fix/compaction-loop
Open

redhox wants to merge 1 commit into
tobi:mainfrom
redhox:fix/compaction-loop

Conversation

@redhox

@redhox redhox commented Oct 23, 2026

Copy link
Copy Markdown

WalGit Forge hit a compaction loop on a modest repository (19 branches, ~2.8k unique objects, 25 packs):

  • write_verified_midx sets pack.allowPackReuse=multi, which lets pack-objects reuse deltas across packs. A clone then receives a thin pack whose delta bases are absent, ending in unresolved deltas, invalid index-pack output and pack-objects crashes.
  • rev-list --test-bitmap <tip> was treated as fatal. Git selects only a subset of commits for a MIDX bitmap, so a branch tip is not guaranteed to have one; the fold aborted after publishing additive packs and never sealed, so the repository grew without bound.
  • A crashed multi-pack-index write leaves a lock that blocks the repository indefinitely.

This change:

  • sets pack.allowPackReuse=single;
  • refreshes the commit-graph before writing the MIDX bitmap;
  • treats a failed rev-list --test-bitmap as a warning, leaving ordinary traversal available;
  • removes a multi-pack-index.lock older than an hour;
  • backs off exponentially per repository after repeated maintenance failures.

Validated on the production instance: compaction now seals (9 packs superseded into 1, pack count 25 → 8), rev-list --test-bitmap passes, and repeated full clones succeed.

- Stop setting pack.allowPackReuse=multi: multi-pack reuse produces thin
  packs whose delta bases are absent for a cloning client, ending in
  unresolved deltas and pack-objects crashes.
- Treat a failing rev-list --test-bitmap as non-fatal: Git selects only a
  subset of commits for a MIDX bitmap, so a branch tip is not guaranteed to
  have one. Ordinary traversal stays available and the fold can seal.
- Refresh the commit-graph before building the MIDX bitmap.
- Clear a stale multi-pack-index.lock left by a crashed writer.
- Back off exponentially per repository after repeated maintenance failures.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant