From 91724cfd417aa4f5e29f47eaf6c8570fa16886ad Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Wed, 19 Mar 2025 13:58:43 +0100 Subject: [PATCH] Change precedence order for continue and legacy exact match This doesn't matter for shouldDelegateList, but matters when picking source of RV. RV from continue takes precedence. Kubernetes-commit: 7da942ca7486310893d4f11f3af062957f953555 --- pkg/storage/cacher/delegator.go | 8 ++++---- pkg/util/flowcontrol/request/list_work_estimator.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/storage/cacher/delegator.go b/pkg/storage/cacher/delegator.go index 478ae7ac8..0b968eef5 100644 --- a/pkg/storage/cacher/delegator.go +++ b/pkg/storage/cacher/delegator.go @@ -257,14 +257,14 @@ func shouldDelegateList(opts storage.ListOptions, cache delegator.Helper) (deleg case metav1.ResourceVersionMatchNotOlderThan: return delegator.Result{ShouldDelegate: false}, nil case "": - // Legacy exact match - if opts.Predicate.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" { - return cache.ShouldDelegateExactRV(opts.ResourceVersion, opts.Recursive) - } // Continue if len(opts.Predicate.Continue) > 0 { return cache.ShouldDelegateContinue(opts.Predicate.Continue, opts.Recursive) } + // Legacy exact match + if opts.Predicate.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" { + return cache.ShouldDelegateExactRV(opts.ResourceVersion, opts.Recursive) + } // Consistent Read if opts.ResourceVersion == "" { return cache.ShouldDelegateConsistentRead() diff --git a/pkg/util/flowcontrol/request/list_work_estimator.go b/pkg/util/flowcontrol/request/list_work_estimator.go index 004614314..bc79aac32 100644 --- a/pkg/util/flowcontrol/request/list_work_estimator.go +++ b/pkg/util/flowcontrol/request/list_work_estimator.go @@ -172,14 +172,14 @@ func shouldDelegateList(opts *metav1.ListOptions, cache delegator.Helper) (deleg case metav1.ResourceVersionMatchNotOlderThan: return delegator.Result{ShouldDelegate: false}, nil case "": - // Legacy exact match - if opts.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" { - return cache.ShouldDelegateExactRV(opts.ResourceVersion, defaultRecursive) - } // Continue if len(opts.Continue) > 0 { return cache.ShouldDelegateContinue(opts.Continue, defaultRecursive) } + // Legacy exact match + if opts.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" { + return cache.ShouldDelegateExactRV(opts.ResourceVersion, defaultRecursive) + } // Consistent Read if opts.ResourceVersion == "" { return cache.ShouldDelegateConsistentRead()