Skip to content

use conditional requests for fallback referrers tag updates#2209

Open
1seal wants to merge 1 commit intogoogle:mainfrom
1seal:fix-referrers-fallback-race
Open

use conditional requests for fallback referrers tag updates#2209
1seal wants to merge 1 commit intogoogle:mainfrom
1seal:fix-referrers-fallback-race

Conversation

@1seal
Copy link

@1seal 1seal commented Feb 12, 2026

Summary

  • commitSubjectReferrers used a plain GET-modify-PUT against the shared fallback tag without conditional requests, so concurrent writers could silently overwrite each other (lost-update race)
  • captures ETag from the GET response and sets If-Match (existing tag) or If-None-Match: * (new tag) on the PUT
  • on 412 Precondition Failed, re-reads the current state and retries (up to 3 attempts)
  • the fallback tag PUT is now done directly instead of going through commitManifest, which avoids re-triggering subject referrer logic on the fallback taggable

Test plan

  • go build ./... compiles cleanly
  • go test ./pkg/v1/remote/ -count=1 passes (all existing tests including TestReferrers)
  • no API changes, no new dependencies

fixes #2205

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
@1seal
Copy link
Author

1seal commented Feb 12, 2026

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.

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.

remote: lost update when updating OCI referrers fallback tag under concurrent writers

1 participant