diff options
author | Rishab Joshi <rishab.joshi@mongodb.com> | 2021-01-01 13:38:42 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-01-01 18:38:09 +0000 |
commit | 98a7731d21a8746e584f7092aadbee60a5fad6ef (patch) | |
tree | 58c16744da4728601676462b6486dca62a8a567b /src/mongo/db/pipeline/plan_explainer_pipeline.cpp | |
parent | 1cd598a3dbfca4a3e29037d6f1d30750ed962d07 (diff) | |
download | mongo-98a7731d21a8746e584f7092aadbee60a5fad6ef.tar.gz |
SERVER-47640 $lookup should increment the serverStatus metrics.queryExecutor counters
Diffstat (limited to 'src/mongo/db/pipeline/plan_explainer_pipeline.cpp')
-rw-r--r-- | src/mongo/db/pipeline/plan_explainer_pipeline.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/plan_explainer_pipeline.cpp b/src/mongo/db/pipeline/plan_explainer_pipeline.cpp index 550e8b7135c..64759c4ca3c 100644 --- a/src/mongo/db/pipeline/plan_explainer_pipeline.cpp +++ b/src/mongo/db/pipeline/plan_explainer_pipeline.cpp @@ -32,6 +32,7 @@ #include "mongo/db/pipeline/plan_explainer_pipeline.h" #include "mongo/db/pipeline/document_source_cursor.h" +#include "mongo/db/pipeline/document_source_lookup.h" #include "mongo/db/pipeline/document_source_sort.h" #include "mongo/db/pipeline/plan_executor_pipeline.h" #include "mongo/db/query/explain.h" @@ -55,12 +56,18 @@ void PlanExplainerPipeline::getSummaryStats(PlanSummaryStats* statsOut) const { } for (auto&& source : _pipeline->getSources()) { - if (dynamic_cast<DocumentSourceSort*>(source.get())) - statsOut->hasSortStage = true; - statsOut->usedDisk = statsOut->usedDisk || source->usedDisk(); - if (statsOut->usedDisk && statsOut->hasSortStage) - break; + + if (dynamic_cast<DocumentSourceSort*>(source.get())) { + statsOut->hasSortStage = true; + } else if (auto docSourceLookUp = dynamic_cast<DocumentSourceLookUp*>(source.get())) { + auto specificStats = docSourceLookUp->getSpecificStats(); + invariant(specificStats); + auto lookupSpecificStats = + dynamic_cast<const DocumentSourceLookupStats*>(specificStats); + invariant(lookupSpecificStats); + statsOut->accumulate(lookupSpecificStats->planSummaryStats); + } } if (_nReturned) { |