From e67b3225a48fca0ee163a1a38a53a0cb5856f01d Mon Sep 17 00:00:00 2001 From: Jonathan Basseri Date: Wed, 25 Apr 2018 10:54:17 -0700 Subject: [PATCH] Remove predicateResults map from podFitsOnNode. The purpose of this map is to combine two predicate results before writing to the equivalence cache. However, the branch that combines results is unreachable. 1. Combining results happens in the second iteration of the outer loop. 2. There is only a second iteration when podsAdded is true. 3. We skip equiv. cache when podsAdded is true. --- pkg/scheduler/core/generic_scheduler.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pkg/scheduler/core/generic_scheduler.go b/pkg/scheduler/core/generic_scheduler.go index c222b80d314..2edb785ba1f 100644 --- a/pkg/scheduler/core/generic_scheduler.go +++ b/pkg/scheduler/core/generic_scheduler.go @@ -468,7 +468,6 @@ func podFitsOnNode( eCacheAvailable bool failedPredicates []algorithm.PredicateFailureReason ) - predicateResults := make(map[string]HostPredicate) podsAdded := false // We run predicates twice in some cases. If the node has greater or equal priority @@ -532,20 +531,11 @@ func podFitsOnNode( } if eCacheAvailable { - // Store data to update equivClassCacheafter this loop. - if res, exists := predicateResults[predicateKey]; exists { - res.Fit = res.Fit && fit - res.FailReasons = append(res.FailReasons, reasons...) - predicateResults[predicateKey] = res - } else { - predicateResults[predicateKey] = HostPredicate{Fit: fit, FailReasons: reasons} - } // Skip update if NodeInfo is stale. if cache != nil && cache.IsUpToDate(info) { - result := predicateResults[predicateKey] ecache.UpdateCachedPredicateItem( pod.GetName(), info.Node().GetName(), - predicateKey, result.Fit, result.FailReasons, equivCacheInfo.hash, false) + predicateKey, fit, reasons, equivCacheInfo.hash, false) } } }