Repository navigation
Write the manifest object before the tag and the referrer link - #2
Merged
Merged
Conversation
In the non-immutable-tag path the manifest-by-digest write ran in parallel with the tag and referrer link writes. If the manifest write failed while the link write succeeded, the link pointed at a manifest that was never stored, and a client following referrer links waited for it indefinitely. Await the digest write first; a failed write now leaves no link and no tag. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Problem. For a manifest pushed by digest or by a mutable tag,
putManifestInnerwrote the manifest-by-digest object, the tag and the referrer link (<repo>/_referrers/<subject>/<digest>) concurrently. If storage refused the manifest write (for example, a transient R2 error) while the link or tag write succeeded, the link or tag named a manifest that doesn't exist. A client that follows referrer links then waits indefinitely for the missing manifest.Fix. Await the manifest-by-digest write first. The tag and referrer-link writes start only after it has succeeded. If the manifest write fails, nothing that names it is written, and a retried PUT (every write here is write-once) completes all three. The immutable-tag branch already ordered its writes this way and is unchanged.
Tests (
test/r2-write-order.test.ts), for each push style (mutable tag, immutable tag, by digest):The suite goes from 125 to 131 tests; typecheck, eslint and prettier are clean.