From 634867703b7eb40f073198d27633a7c5506e4604 Mon Sep 17 00:00:00 2001 From: Ruoxin Xu Date: Fri, 24 Sep 2021 13:43:15 +0000 Subject: SERVER-59854 Remove PlanCacheIndexabilityState from the PlanCache This patch includes a number of changes to facilitate the use of PlanCacheIndexabilityState with SBE and classic plan cache keys. * Introduced a plan cache key factory. * Moved PlanCacheIndexabilityState from the PlanCache into CollectionQueryInfo. * Templetized QueryPlanner::planSubqueries() so it can be used with classic and SBE plan caches. * Removed dependency on the CanonicalQuery from the PlanCache class. Co-authored-by: Anton Korshunov --- src/mongo/db/query/lru_key_value.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mongo/db/query/lru_key_value.h') diff --git a/src/mongo/db/query/lru_key_value.h b/src/mongo/db/query/lru_key_value.h index abb5cf475fd..3d2430c1c74 100644 --- a/src/mongo/db/query/lru_key_value.h +++ b/src/mongo/db/query/lru_key_value.h @@ -202,18 +202,19 @@ public: /** * Remove the kv-store entry keyed by 'key'. + * Returns false if there doesn't exist such 'key', otherwise returns true. */ - Status remove(const K& key) { + bool remove(const K& key) { KVMapConstIt i = _kvMap.find(key); if (i == _kvMap.end()) { - return Status(ErrorCodes::NoSuchKey, "no such key in LRU key-value store"); + return false; } KVListIt found = i->second; _budgetTracker.onRemove(*i->second->second); delete found->second; _kvMap.erase(i); _kvList.erase(found); - return Status::OK(); + return true; } /** -- cgit v1.2.1