feat: deduplicate Archive object references#71
Open
ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
Open
feat: deduplicate Archive object references#71ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
Conversation
…e projections Port of upstream PR cloudnative-pg#331. When the same Archive is referenced multiple times (e.g. as both archive and recovery), volume projections were duplicated causing Job creation failures. Signed-off-by: ermakov-oleg <ermakovolegs@gmail.com>
e667600 to
a3c4d00
Compare
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
Port of upstream #331
Problem:
GetReferredArchiveObjectsKey()returned all three possible archive references (primary, recovery, replica source) without deduplication. In common setups, the same Archive object is used for multiple purposes (e.g. primary and recovery point to the same object). This caused the reconciler to fetch and process the same Archive object 2-3 times per reconciliation loop, wasting API calls and potentially causing race conditions.Fix: Added deduplication using a
seenmap — each uniqueNamespacedNameis only included once in the result. The function now returns at most 3 items, but typically 1-2 in real deployments where archives are shared.