diff options
author | David Storch <david.storch@mongodb.com> | 2020-06-01 17:44:50 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-02 18:46:44 +0000 |
commit | d82c036d05a7898dd17ca219f626cf4fd4759c79 (patch) | |
tree | 183d08808c451dec593fd4b3f2cf6b857654c336 /src/mongo/db/query | |
parent | 1c05f9d9e4a7deb7fd3ca4d7874be6d18c4f7192 (diff) | |
download | mongo-d82c036d05a7898dd17ca219f626cf4fd4759c79.tar.gz |
SERVER-48529 Delete PlanCache::feedback() and related code
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/plan_cache.cpp | 25 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache.h | 19 | ||||
-rw-r--r-- | src/mongo/db/query/query_knobs.idl | 9 |
3 files changed, 0 insertions, 53 deletions
diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index f0c7e0384cd..5a8e140a3c5 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -240,7 +240,6 @@ std::unique_ptr<PlanCacheEntry> PlanCacheEntry::create( queryHash, planCacheKey, std::move(decision), - {}, isActive, works)); } @@ -254,7 +253,6 @@ PlanCacheEntry::PlanCacheEntry(std::vector<std::unique_ptr<const SolutionCacheDa const uint32_t queryHash, const uint32_t planCacheKey, std::unique_ptr<const PlanRankingDecision> decision, - std::vector<double> feedback, const bool isActive, const size_t works) : plannerData(std::move(plannerData)), @@ -266,7 +264,6 @@ PlanCacheEntry::PlanCacheEntry(std::vector<std::unique_ptr<const SolutionCacheDa queryHash(queryHash), planCacheKey(planCacheKey), decision(std::move(decision)), - feedback(std::move(feedback)), isActive(isActive), works(works), _entireObjectSize(_estimateObjectSizeInBytes()) { @@ -296,7 +293,6 @@ std::unique_ptr<PlanCacheEntry> PlanCacheEntry::clone() const { queryHash, planCacheKey, std::move(decisionPtr), - feedback, isActive, works)); } @@ -307,8 +303,6 @@ uint64_t PlanCacheEntry::_estimateObjectSizeInBytes() const { plannerData, [](const auto& cacheData) { return cacheData->estimateObjectSizeInBytes(); }, true) + - // Add size of each entry in '_feedback' vector. - container_size_helper::estimateObjectSizeInBytes(feedback) + // Add the entire size of 'decision' object. (decision ? decision->estimateObjectSizeInBytes() : 0) + // Add the size of all the owned BSON objects. @@ -672,25 +666,6 @@ PlanCache::GetResult PlanCache::get(const PlanCacheKey& key) const { return {state, std::make_unique<CachedSolution>(key, *entry)}; } -Status PlanCache::feedback(const CanonicalQuery& cq, double score) { - PlanCacheKey ck = computeKey(cq); - - stdx::lock_guard<Latch> cacheLock(_cacheMutex); - PlanCacheEntry* entry; - Status cacheStatus = _cache.get(ck, &entry); - if (!cacheStatus.isOK()) { - return cacheStatus; - } - invariant(entry); - - // We store up to a constant number of feedback entries. - if (entry->feedback.size() < static_cast<size_t>(internalQueryCacheFeedbacksStored.load())) { - entry->feedback.push_back(score); - } - - return Status::OK(); -} - Status PlanCache::remove(const CanonicalQuery& canonicalQuery) { stdx::lock_guard<Latch> cacheLock(_cacheMutex); return _cache.remove(computeKey(canonicalQuery)); diff --git a/src/mongo/db/query/plan_cache.h b/src/mongo/db/query/plan_cache.h index 4d448650808..c5d3133302d 100644 --- a/src/mongo/db/query/plan_cache.h +++ b/src/mongo/db/query/plan_cache.h @@ -365,9 +365,6 @@ public: // Information that went into picking the winning plan and also why the other plans lost. const std::unique_ptr<const PlanRankingDecision> decision; - // Scores from uses of this cache entry. - std::vector<double> feedback; - // Whether or not the cache entry is active. Inactive cache entries should not be used for // planning. bool isActive = false; @@ -396,7 +393,6 @@ private: uint32_t queryHash, uint32_t planCacheKey, std::unique_ptr<const PlanRankingDecision> decision, - std::vector<double> feedback, bool isActive, size_t works); @@ -516,21 +512,6 @@ public: */ std::unique_ptr<CachedSolution> getCacheEntryIfActive(const PlanCacheKey& key) const; - - /** - * When the CachedPlanStage runs a plan out of the cache, we want to record data about the - * plan's performance. The CachedPlanStage calls feedback(...) after executing the cached - * plan for a trial period in order to do this. Currently, the only feedback metric recorded is - * the score associated with the cached plan trial period. - * - * If the entry corresponding to 'cq' isn't in the cache anymore, the feedback is ignored - * and an error Status is returned. - * - * If the entry corresponding to 'cq' still exists, 'feedback' is added to the run - * statistics about the plan. Status::OK() is returned. - */ - Status feedback(const CanonicalQuery& cq, double score); - /** * Remove the entry corresponding to 'ck' from the cache. Returns Status::OK() if the plan * was present and removed and an error status otherwise. diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl index 644c5c0fab9..618e9aedd8d 100644 --- a/src/mongo/db/query/query_knobs.idl +++ b/src/mongo/db/query/query_knobs.idl @@ -98,15 +98,6 @@ server_parameters: validator: gte: 0 - internalQueryCacheFeedbacksStored: - description: "How many feedback entries do we collect before possibly evicting from the cache based on bad performance?" - set_at: [ startup, runtime ] - cpp_varname: "internalQueryCacheFeedbacksStored" - cpp_vartype: AtomicWord<int> - default: 20 - validator: - gte: 0 - internalQueryCacheEvictionRatio: description: "How many times more works must we perform in order to justify plan cache eviction and replanning?" set_at: [ startup, runtime ] |