diff options
author | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2017-03-17 14:05:04 -0400 |
---|---|---|
committer | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2017-03-21 18:23:45 -0400 |
commit | dd260b0a3bde58530504e982b8f4acd753f71739 (patch) | |
tree | dae1304d243c9eb987d3d934b661a7105adf25da /src | |
parent | 7cd3934080fcf0a14e8133074cd77598285126a1 (diff) | |
download | mongo-dd260b0a3bde58530504e982b8f4acd753f71739.tar.gz |
SERVER-26113 explain() for aggregation request does not propogate to corresponding 'QueryRequest'
Small change to bug fix, and adding explain.js test.
Formatting changes
Missed formatting
Incorporating CR feedback
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/pipeline/pipeline_d.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache.cpp | 9 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index c37c1301198..57cfe0f53d7 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -304,6 +304,7 @@ StatusWith<std::unique_ptr<PlanExecutor>> attemptToGetExecutor( qr->setProj(projectionObj); qr->setSort(sortObj); if (aggRequest) { + qr->setExplain(static_cast<bool>(aggRequest->getExplain())); qr->setHint(aggRequest->getHint()); } diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index ff8b32f6a6e..b0a80b537ee 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -283,11 +283,10 @@ bool PlanCache::shouldCacheQuery(const CanonicalQuery& query) { return false; } - // Explain queries are not-cacheable. This is primarily because of - // the need to generate current and accurate information in allPlans. - // If the explain report is generated by the cached plan runner using - // stale information from the cache for the losing plans, allPlans would - // simply be wrong. + // We don't read or write from the plan cache for explain. This ensures + // that explain queries don't affect cache state, and it also makes + // sure that we can always generate information regarding rejected plans + // and/or trial period execution of candidate plans. if (qr.isExplain()) { return false; } |