summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/explain.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/explain.h')
-rw-r--r--src/mongo/db/query/explain.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/mongo/db/query/explain.h b/src/mongo/db/query/explain.h
index d41dd3a1725..1dcabdeb7e3 100644
--- a/src/mongo/db/query/explain.h
+++ b/src/mongo/db/query/explain.h
@@ -39,6 +39,7 @@ namespace mongo {
class Collection;
class CollectionPtr;
+class MultipleCollectionAccessor;
class OperationContext;
class PlanExecutorPipeline;
struct PlanSummaryStats;
@@ -77,15 +78,26 @@ public:
BSONObj extraInfo,
const BSONObj& command,
BSONObjBuilder* out);
+
+ /**
+ * Similar to the above function, but takes in multiple collections instead to support
+ * aggregation that involves multiple collections (e.g. $lookup).
+ */
+ static void explainStages(PlanExecutor* exec,
+ const MultipleCollectionAccessor& collections,
+ ExplainOptions::Verbosity verbosity,
+ BSONObj extraInfo,
+ const BSONObj& command,
+ BSONObjBuilder* out);
+
/**
* Adds "queryPlanner" and "executionStats" (if requested in verbosity) fields to 'out'. Unlike
* the other overload of explainStages() above, this one does not add the "serverInfo" section.
*
* - 'exec' is the stage tree for the operation being explained.
- * - 'collection' is the relevant collection. During this call it may be required to execute the
- * plan to collect statistics. If the PlanExecutor uses 'kLockExternally' lock policy, the
- * caller should hold at least an IS lock on the collection the that the query runs on, even if
- * 'collection' parameter is nullptr.
+ * - 'collections' are the relevant main and secondary collections (e.g. for $lookup). If the
+ * PlanExecutor uses 'kLockExternally' lock policy, the caller should hold the necessary db_raii
+ * object on the involved collections.
* - 'verbosity' is the verbosity level of the explain.
* - 'extraInfo' specifies additional information to include into the output.
* - 'executePlanStatus' is the status returned after executing the query (Status::OK if the
@@ -97,7 +109,7 @@ public:
*/
static void explainStages(
PlanExecutor* exec,
- const CollectionPtr& collection,
+ const MultipleCollectionAccessor& collections,
ExplainOptions::Verbosity verbosity,
Status executePlanStatus,
boost::optional<PlanExplainer::PlanStatsDetails> winningPlanTrialStats,