fix: bound tiered etag metadata writes#381
Conversation
Only publish tiered cache ETags when a successful write replaces an existing authoritative object with a different ETag, avoiding unbounded metadata growth for immutable cache keys.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ddbf81106c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| case errors.Is(err, os.ErrNotExist): | ||
| return false, nil |
There was a problem hiding this comment.
Publish replacements even after authoritative eviction
When the authoritative tier returns os.ErrNotExist here, the write is treated as a new key and tieredWriter.Close() never records the new ETag. Cache implementations are allowed to evict objects independently, so with a shorter remote/authoritative TTL (or eviction) and longer local tiers, other replicas can still hold the old ETag; because invalidateStale() only checks metadata, those local hits will keep serving stale content after this replacement. Previously every successful create published the ETag, so this regresses mutable keys whenever the authoritative copy disappeared before the replacement write.
Useful? React with 👍 / 👎.
Only publish tiered cache ETags when a successful write replaces an existing authoritative object with a different ETag, avoiding unbounded metadata growth for immutable cache keys.