use conditional requests for fallback referrers tag updates#2209
Open
1seal wants to merge 1 commit intogoogle:mainfrom
Open
use conditional requests for fallback referrers tag updates#22091seal wants to merge 1 commit intogoogle:mainfrom
1seal wants to merge 1 commit intogoogle:mainfrom
Conversation
the fallback tag update in commitSubjectReferrers used a plain GET-modify-PUT sequence without conditional requests. concurrent writers attaching referrers to the same subject could silently overwrite each other, dropping referrers from the fallback index. use ETag / If-Match / If-None-Match headers on the PUT request and retry on 412 Precondition Failed (up to 3 attempts) so that concurrent updates are detected and retried instead of lost. fixes google#2205
Author
|
hi @Subserial — this adds If-Match conditional requests to the fallback referrers tag update path to prevent silent data loss under concurrent writers. test included. happy to iterate. |
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.
Summary
commitSubjectReferrersused a plain GET-modify-PUT against the shared fallback tag without conditional requests, so concurrent writers could silently overwrite each other (lost-update race)ETagfrom the GET response and setsIf-Match(existing tag) orIf-None-Match: *(new tag) on the PUT412 Precondition Failed, re-reads the current state and retries (up to 3 attempts)commitManifest, which avoids re-triggering subject referrer logic on the fallback taggableTest plan
go build ./...compiles cleanlygo test ./pkg/v1/remote/ -count=1passes (all existing tests includingTestReferrers)fixes #2205