Repository navigation
storage: avoid per-blob manifest lookups during garbage collection - #5100
Merged
milosgajdos merged 6 commits intoNov 25, 2026
Merged
Conversation
Cover redundant manifest probes, alias lookup failures, interrupted enumeration and malformed references followed by a valid layer. Add a filesystem GC benchmark using default progress output and deterministic image metadata. Signed-off-by: Perfloop Agent <[email protected]>
Collect repository revisions before following references and build membership after enumeration. Preserve ordered recursive traversal and use checked storage lookups for aliases or incomplete walks. Classify canonical digests without panicking on malformed stored references, retaining the existing handling of invalid operands. Signed-off-by: Perfloop Agent <[email protected]>
Leave the manifest-existence error policy unchanged while reusing the revision snapshot. Add coverage for alias-only child references and for stopping before sweep when the first of two manifest reads fails. Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
Build the canonical manifest inventory after successful enumeration. Preserve alias and interrupted-enumeration lookups without coupling generic walks or linked blob enumeration to GC-only status tracking. GC continues to require stopped or read-only storage. Signed-off-by: Perfloop Agent <[email protected]>
milosgajdos
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#4285 added recursive GC marking with per-reference manifest probes, so registry operators running GC also pay storage lookups for layers and configuration blobs. On the committed OCI manifest example plus an empty image at default settings, median GC elapsed time changed from 2741621 to 2571477 ns/op across 70 pairs.
MarkAndSweepnow snapshots each repository's revisions before traversal and uses in-memory membership for canonical references after a complete inventory.cc @milosgajdos
The local filesystem image benchmark measured median elapsed time of 121298794 ns/op before and 110555453 ns/op after across 138 pairs. On the
BenchmarkGarbageCollectfixture, whole-GCGetContentcalls fell from 663 to 462;StatandWalkwere unchanged. A repository with a dangling revision link keeps the reduction.This change edits the same lines in
markManifestReferencesas #5083, and whichever merges second will be rebased.Small-repository workloads added two to five allocations per collection for ordered snapshot bookkeeping. Tested smaller construction alternatives allocated more.
GC still requires stopped or read-only storage. Snapshot memory grows with manifest count. Remote-backend and production effects remain unmeasured.
registry/storage/garbagecollect_test.goincludes the native filesystem benchmark. A further reproduction recipe isgo test -count=1 -run='^$' -bench='^BenchmarkGarbageCollect$' -benchmem -benchtime=20x ./registry/storage.This change was developed with AI assistance.
Measurement details and validation
For the OCI example, the paired median elapsed-time change was −169046 ns/op, with sequential median bounds of −267984 to −26288 ns/op from 70 complete pairs. Its referenced blobs are missing; it is not a production workload sample.
For the filesystem image benchmark, the paired median change was −10571783 ns/op, with sequential median bounds of −13321921 to −9183317 ns/op from 138 complete pairs.
Aliases and interrupted enumeration retain existence lookups. Lookup error handling stays unchanged from main.
Go storage tests passed.
Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart.