summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/explain.h
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2020-09-17 17:09:19 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-26 02:12:49 +0000
commit2b82ab88982566114d1bb7667477b71c883b0799 (patch)
treec152b35ff047fdc42f69aa6cd6b04fee1d811fe4 /src/mongo/db/query/explain.h
parent08e92a678a1ed288f6a95e7950597e082556ae59 (diff)
downloadmongo-2b82ab88982566114d1bb7667477b71c883b0799.tar.gz
SERVER-50984 Add CollectionPtr to replace usage of const Collection*
It implements a yieldable interface that is used to re-load the Collection pointer from the catalog after a yield that released locks. With lock-free reads and copy-on-write on Collection instances releasing locks without notifying an AutoGetCollection at a higher level may cause its pointers to dangle if a MODE_X writer installs a new Collection instance in the catalog. CollectionPtr should be passed by const reference so a yield can notify all the way up.
Diffstat (limited to 'src/mongo/db/query/explain.h')
-rw-r--r--src/mongo/db/query/explain.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/query/explain.h b/src/mongo/db/query/explain.h
index 666959883b2..a8848decfc1 100644
--- a/src/mongo/db/query/explain.h
+++ b/src/mongo/db/query/explain.h
@@ -42,6 +42,7 @@
namespace mongo {
class Collection;
+class CollectionPtr;
class OperationContext;
class PlanExecutorPipeline;
struct PlanSummaryStats;
@@ -72,7 +73,7 @@ public:
* added to the "executionStats" section of the explain.
*/
static void explainStages(PlanExecutor* exec,
- const Collection* collection,
+ const CollectionPtr& collection,
ExplainOptions::Verbosity verbosity,
BSONObj extraInfo,
BSONObjBuilder* out);
@@ -92,7 +93,7 @@ public:
* - 'out' is the builder for the explain output.
*/
static void explainStages(PlanExecutor* exec,
- const Collection* collection,
+ const CollectionPtr& collection,
ExplainOptions::Verbosity verbosity,
Status executePlanStatus,
PlanStageStats* winningPlanTrialStats,
@@ -205,7 +206,7 @@ private:
* - 'out' is a builder for the explain output.
*/
static void generatePlannerInfo(PlanExecutor* exec,
- const Collection* collection,
+ const CollectionPtr& collection,
BSONObj extraInfo,
BSONObjBuilder* out);