diff options
author | Arun Banala <arun.banala@10gen.com> | 2019-10-02 15:27:39 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-02 15:27:39 +0000 |
commit | bda366f0b0e432ca143bc41da54d8732bd8d03c0 (patch) | |
tree | 43b09749ba831ad5f26bf0f8af636cfcb24e2fb4 /src/mongo/db/commands | |
parent | a9674251a5f0fc9785d787f3f7922312c37d4a04 (diff) | |
download | mongo-r4.0.13.tar.gz |
SERVER-40382 Add a serverStatus metric to report plan cache memory consumptionr4.0.13-rc0r4.0.13
(cherry picked from commit 5105fa2377d3e86b2011691d5acbd8c531113929)
(cherry picked from commit 5eeba7b2c9dda32a37c2c16ca14edd9a9099a996)
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/index_filter_commands_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/plan_cache_commands.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/commands/plan_cache_commands_test.cpp | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/commands/index_filter_commands_test.cpp b/src/mongo/db/commands/index_filter_commands_test.cpp index 00c4ff6775a..910d404efec 100644 --- a/src/mongo/db/commands/index_filter_commands_test.cpp +++ b/src/mongo/db/commands/index_filter_commands_test.cpp @@ -105,7 +105,7 @@ vector<BSONObj> getFilters(const QuerySettings& querySettings) { /** * Utility function to create a PlanRankingDecision */ -PlanRankingDecision* createDecision(size_t numPlans) { +std::unique_ptr<PlanRankingDecision> createDecision(size_t numPlans) { unique_ptr<PlanRankingDecision> why(new PlanRankingDecision()); for (size_t i = 0; i < numPlans; ++i) { CommonStats common("COLLSCAN"); @@ -115,7 +115,7 @@ PlanRankingDecision* createDecision(size_t numPlans) { why->scores.push_back(0U); why->candidateOrder.push_back(i); } - return why.release(); + return why; } /** diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp index 0a40549acbf..b48c498916d 100644 --- a/src/mongo/db/commands/plan_cache_commands.cpp +++ b/src/mongo/db/commands/plan_cache_commands.cpp @@ -407,9 +407,8 @@ Status PlanCacheListPlans::list(OperationContext* opCtx, // Create the plan details field. Currently, this is a simple string representation of // SolutionCacheData. - SolutionCacheData* scd = entry->plannerData[i]; BSONObjBuilder detailsBob(planBob.subobjStart("details")); - detailsBob.append("solution", scd->toString()); + detailsBob.append("solution", entry->plannerData[i]->toString()); detailsBob.doneFast(); // reason is comprised of score and initial stats provided by @@ -437,7 +436,7 @@ Status PlanCacheListPlans::list(OperationContext* opCtx, } feedbackBob.doneFast(); - planBob.append("filterSet", scd->indexFilterApplied); + planBob.append("filterSet", entry->plannerData[i]->indexFilterApplied); } plansBuilder.doneFast(); diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp index 174b64abbb9..09bb15e1abe 100644 --- a/src/mongo/db/commands/plan_cache_commands_test.cpp +++ b/src/mongo/db/commands/plan_cache_commands_test.cpp @@ -114,7 +114,7 @@ SolutionCacheData* createSolutionCacheData() { /** * Utility function to create a PlanRankingDecision */ -PlanRankingDecision* createDecision(size_t numPlans) { +std::unique_ptr<PlanRankingDecision> createDecision(size_t numPlans) { unique_ptr<PlanRankingDecision> why(new PlanRankingDecision()); for (size_t i = 0; i < numPlans; ++i) { CommonStats common("COLLSCAN"); @@ -124,7 +124,7 @@ PlanRankingDecision* createDecision(size_t numPlans) { why->scores.push_back(0U); why->candidateOrder.push_back(i); } - return why.release(); + return why; } TEST(PlanCacheCommandsTest, planCacheListQueryShapesEmpty) { |