fix: improve reliability of object cache management#63
Open
ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
Open
fix: improve reliability of object cache management#63ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
Conversation
fc684be to
b3a439a
Compare
Signed-off-by: ermakov-oleg <ermakovolegs@gmail.com>
b3a439a to
a4a03af
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 #508, #429
Fixes 5 bugs in
ExtendedClientcache that made caching completely non-functional:isObjectCached: checked for*corev1.Secretinstead of*pgbackrestv1.Archive, so Archive objects were never recognized as cacheablegetCachedObject: compared objects viaGetObjectKind().GroupVersionKind()which returns empty GVK for decoded objects — replaced withreflect.TypeOf()comparisonremoveObject: used!=instead of==for GVK comparison, so cache invalidation never matched the right object — same fix withreflect.TypeOf()cachedEntry.ttlwas never set, defaulting to 0 — every cached entry expired immediately on next accessisExpired():time.Now().Unix() - fetchUnixTimereturns seconds, butint64(ttl)yields nanoseconds — fixed withtime.Since(time.Unix(fetchUnixTime, 0)) > ttlAdded 5 new unit tests (cache Archive objects, distinguish by type, removeObject matching, removeObject with shared keys, TTL initialization) and updated existing expired test to use real TTL.