Repository navigation
fix(storage): cache blob descriptors only after linking - #5105
Merged
milosgajdos merged 1 commit intoNov 27, 2026
Merged
Conversation
Member
|
@perfloop-agent please squash your commits |
tsenart
force-pushed
the
perfloop-pr-open-bbz5hwfnvs
branch
from
November 26, 2026 20:52
987c145 to
8663c79
Compare
|
@milosgajdos squashed into one commit, with the same code as before. The CI runs are now waiting for a maintainer to approve them, because I pushed the squash from my account. Could you approve them? |
Publishing the repository descriptor before its link is written lets cached lookups find an unlinked blob after a storage error. Write the link before populating the descriptor cache, matching blobWriter.Commit, and return an empty descriptor if linking fails. This does not roll back preexisting links or writes completed by the driver before an error is reported. Exercise data and repository link write failures with and without a descriptor cache. Verify failed puts remain unavailable, return no blob descriptor, and can be retried successfully. Signed-off-by: Perfloop Agent <[email protected]>
perfloop-agent
force-pushed
the
perfloop-pr-open-bbz5hwfnvs
branch
from
November 26, 2026 22:13
8663c79 to
7ee51e3
Compare
milosgajdos
approved these changes
Nov 27, 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.
With a descriptor cache enabled, a failed repository-link write can make a newly uploaded manifest look present even though storage has no repository link. Cache eviction can then make it disappear. Put now writes the link before caching its descriptor, preventing failed link creation from advertising an unlinked digest.
cc @milosgajdos
linkedBlobStore.Putkeeps the global data write first, then creates the repository link and updates the descriptor cache, matchingblobWriter.Commit. A link error returns a zero blob descriptor and the original error.When custom
SetDescriptormiddleware rejects a small-blob put and the client retries, each retry now writes the link first, taking about 4.09 ms instead of 35.2 µs and allocating 15.4 KB in 99 allocations instead of 3.13 KB in 39. Shipped cache setters do not reject puts.This is not transactional rollback: pre-existing links and writes completed by storage before reporting an error remain intact.
Go tests for the scoped blob/manifest storage paths and descriptor caches, including Redis, passed.
AI assisted with this change.
Regression coverage
The regression test in
registry/storage/linkedblobstore_test.gocovers data-write and link-write failures with caching enabled and disabled for small blobs, Docker schema2 manifests, OCI manifests, manifest lists and OCI indexes. Successful retries on the same store populate the cache and return the original bytes.Paired filesystem comparison of small-blob retries with rejecting custom descriptor middleware:
Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart.