diff options
author | David Storch <david.storch@10gen.com> | 2015-08-10 14:45:12 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-08-11 12:11:44 -0400 |
commit | 3f8b8b495fbe5303bb39dcd2ba5708275f482d2e (patch) | |
tree | 2cd0d817023c0ecf61d77db9f5adee91783aa731 /src/mongo/db/exec/subplan.cpp | |
parent | 8484342532a06f3c578047a446b87498669c7bac (diff) | |
download | mongo-3f8b8b495fbe5303bb39dcd2ba5708275f482d2e.tar.gz |
SERVER-19835 change SubplanStage to skip creation of a plan cache entry in edge cases
Since the SubplanStage does not benefit from the CachedPlanStage's replanning, it should not create
a cache entry if there is a plan ranking tie or if zero results are produced during the plan ranking
trial period.
Diffstat (limited to 'src/mongo/db/exec/subplan.cpp')
-rw-r--r-- | src/mongo/db/exec/subplan.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp index ccdc040bc38..91ef35743d5 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -322,8 +322,13 @@ Status SubplanStage::choosePlanForSubqueries(PlanYieldPolicy* yieldPolicy) { _ws->clear(); - MultiPlanStage multiPlanStage( - getOpCtx(), _collection, branchResult->canonicalQuery.get()); + // We pass the SometimesCache option to the MPS because the SubplanStage currently does + // not use the CachedPlanStage's eviction mechanism. We therefore are more conservative + // about putting a potentially bad plan into the cache in the subplan path. + MultiPlanStage multiPlanStage(getOpCtx(), + _collection, + branchResult->canonicalQuery.get(), + MultiPlanStage::CachingMode::SometimesCache); // Dump all the solutions into the MPS. for (size_t ix = 0; ix < branchResult->solutions.size(); ++ix) { |