diff options
author | David Storch <david.storch@10gen.com> | 2018-08-08 11:53:07 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2018-08-09 15:54:07 -0400 |
commit | 8c2cd4720c59dae92c2b284efaec0f88a08b797a (patch) | |
tree | 577997444fde6fa034af5db89c83672cbb53c2ce /src/mongo/db/query/plan_cache.cpp | |
parent | fc758e567998b87a2360c1c49e3bd0b74da3796b (diff) | |
download | mongo-8c2cd4720c59dae92c2b284efaec0f88a08b797a.tar.gz |
SERVER-35980 Delete PlanCacheEntryFeedback.
This type was only used to house the score of the plan and
thus was not needed. We are removing it in advance of
planned format changes for the planCacheListPlans command.
Diffstat (limited to 'src/mongo/db/query/plan_cache.cpp')
-rw-r--r-- | src/mongo/db/query/plan_cache.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index f132dc077b9..ac5015b08d1 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -411,9 +411,6 @@ PlanCacheEntry::PlanCacheEntry(const std::vector<QuerySolution*>& solutions, } PlanCacheEntry::~PlanCacheEntry() { - for (size_t i = 0; i < feedback.size(); ++i) { - delete feedback[i]; - } for (size_t i = 0; i < plannerData.size(); ++i) { delete plannerData[i]; } @@ -439,12 +436,8 @@ PlanCacheEntry* PlanCacheEntry::clone() const { entry->works = works; // Copy performance stats. - for (size_t i = 0; i < feedback.size(); ++i) { - PlanCacheEntryFeedback* fb = new PlanCacheEntryFeedback(); - fb->stats.reset(feedback[i]->stats->clone()); - fb->score = feedback[i]->score; - entry->feedback.push_back(fb); - } + entry->feedback = feedback; + return entry; } @@ -923,11 +916,7 @@ PlanCache::GetResult PlanCache::get(const PlanCacheKey& key) const { return {state, stdx::make_unique<CachedSolution>(key, *entry)}; } -Status PlanCache::feedback(const CanonicalQuery& cq, PlanCacheEntryFeedback* feedback) { - if (NULL == feedback) { - return Status(ErrorCodes::BadValue, "feedback is NULL"); - } - std::unique_ptr<PlanCacheEntryFeedback> autoFeedback(feedback); +Status PlanCache::feedback(const CanonicalQuery& cq, double score) { PlanCacheKey ck = computeKey(cq); stdx::lock_guard<stdx::mutex> cacheLock(_cacheMutex); @@ -940,7 +929,7 @@ Status PlanCache::feedback(const CanonicalQuery& cq, PlanCacheEntryFeedback* fee // We store up to a constant number of feedback entries. if (entry->feedback.size() < static_cast<size_t>(internalQueryCacheFeedbacksStored.load())) { - entry->feedback.push_back(autoFeedback.release()); + entry->feedback.push_back(score); } return Status::OK(); |