summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/explain.cpp
diff options
context:
space:
mode:
authorsamontea <merciers.merciers@gmail.com>2019-07-11 11:18:42 -0400
committersamontea <merciers.merciers@gmail.com>2019-07-11 18:26:24 -0400
commit902b3f9135861b69b6581909299a8ada2db6588f (patch)
tree35d2524002504dcbb3cee4cf82b1699b975865f6 /src/mongo/db/query/explain.cpp
parent3962f8222c85c7b5fb2f558cf4269baea3f224cb (diff)
downloadmongo-902b3f9135861b69b6581909299a8ada2db6588f.tar.gz
SERVER-41279 Eliminate failed plans from consideration during query planning
Diffstat (limited to 'src/mongo/db/query/explain.cpp')
-rw-r--r--src/mongo/db/query/explain.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp
index 4f6093959b4..709d8ffda4a 100644
--- a/src/mongo/db/query/explain.cpp
+++ b/src/mongo/db/query/explain.cpp
@@ -331,6 +331,8 @@ void Explain::statsToBSON(const PlanStageStats& stats,
bob->appendNumber("needYield", stats.common.needYield);
bob->appendNumber("saveState", stats.common.yields);
bob->appendNumber("restoreState", stats.common.unyields);
+ if (stats.common.failed)
+ bob->appendBool("failed", stats.common.failed);
bob->appendNumber("isEOF", stats.common.isEOF);
}
@@ -739,6 +741,8 @@ void Explain::generateSinglePlanExecutionInfo(const PlanStageStats* stats,
out->appendNumber("totalKeysExamined", totalKeysExamined);
out->appendNumber("totalDocsExamined", totalDocsExamined);
+ if (stats->common.failed)
+ out->appendBool("failed", stats->common.failed);
// Add the tree of stages, with individual execution stats for each stage.
BSONObjBuilder stagesBob(out->subobjStart("executionStages"));
@@ -1051,6 +1055,11 @@ void Explain::planCacheEntryToBSON(const PlanCacheEntry& entry, BSONObjBuilder*
for (double score : entry.decision->scores) {
scoresBuilder.append(score);
}
+
+ std::for_each(entry.decision->failedCandidates.begin(),
+ entry.decision->failedCandidates.end(),
+ [&scoresBuilder](const auto&) { scoresBuilder.append(0.0); });
+
scoresBuilder.doneFast();
out->append("indexFilterSet", entry.plannerData[0]->indexFilterApplied);