summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/exec/cached_plan.cpp4
-rw-r--r--src/mongo/db/exec/cached_plan.h2
-rw-r--r--src/mongo/db/exec/multi_plan.cpp4
-rw-r--r--src/mongo/db/exec/multi_plan.h4
-rw-r--r--src/mongo/db/exec/subplan.cpp4
-rw-r--r--src/mongo/db/exec/subplan.h1
6 files changed, 14 insertions, 5 deletions
diff --git a/src/mongo/db/exec/cached_plan.cpp b/src/mongo/db/exec/cached_plan.cpp
index d08d0e1bfd9..a8d2d1d592b 100644
--- a/src/mongo/db/exec/cached_plan.cpp
+++ b/src/mongo/db/exec/cached_plan.cpp
@@ -66,7 +66,9 @@ namespace mongo {
_plannerParams(params),
_decisionWorks(decisionWorks),
_root(root),
- _commonStats(kStageType) {}
+ _commonStats(kStageType) {
+ invariant(_collection);
+ }
Status CachedPlanStage::pickBestPlan(PlanYieldPolicy* yieldPolicy) {
// Adds the amount of time taken by pickBestPlan() to executionTimeMillis. There's lots of
diff --git a/src/mongo/db/exec/cached_plan.h b/src/mongo/db/exec/cached_plan.h
index 206258736aa..c5d15fb7cac 100644
--- a/src/mongo/db/exec/cached_plan.h
+++ b/src/mongo/db/exec/cached_plan.h
@@ -121,7 +121,7 @@ namespace mongo {
// Not owned.
OperationContext* _txn;
- // Not owned.
+ // Not owned. Must be non-null.
Collection* _collection;
// Not owned.
diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp
index 96680c38029..3ad74d752ce 100644
--- a/src/mongo/db/exec/multi_plan.cpp
+++ b/src/mongo/db/exec/multi_plan.cpp
@@ -72,7 +72,9 @@ namespace mongo {
_failure(false),
_failureCount(0),
_statusMemberId(WorkingSet::INVALID_ID),
- _commonStats(kStageType) { }
+ _commonStats(kStageType) {
+ invariant(_collection);
+ }
MultiPlanStage::~MultiPlanStage() {
for (size_t ix = 0; ix < _candidates.size(); ++ix) {
diff --git a/src/mongo/db/exec/multi_plan.h b/src/mongo/db/exec/multi_plan.h
index ad55afa8d2e..43596aea247 100644
--- a/src/mongo/db/exec/multi_plan.h
+++ b/src/mongo/db/exec/multi_plan.h
@@ -173,8 +173,10 @@ namespace mongo {
static const int kNoSuchPlan = -1;
- // not owned here
+ // Not owned here.
OperationContext* _txn;
+
+ // Not owned here. Must be non-null.
const Collection* _collection;
// Whether or not we should try to cache the winning plan in the plan cache.
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp
index d86640ed3f6..88cb23e5642 100644
--- a/src/mongo/db/exec/subplan.cpp
+++ b/src/mongo/db/exec/subplan.cpp
@@ -63,7 +63,9 @@ namespace mongo {
_plannerParams(params),
_query(cq),
_child(NULL),
- _commonStats(kStageType) { }
+ _commonStats(kStageType) {
+ invariant(_collection);
+ }
// static
bool SubplanStage::canUseSubplanning(const CanonicalQuery& query) {
diff --git a/src/mongo/db/exec/subplan.h b/src/mongo/db/exec/subplan.h
index ec275c66a92..190da7988f9 100644
--- a/src/mongo/db/exec/subplan.h
+++ b/src/mongo/db/exec/subplan.h
@@ -167,6 +167,7 @@ namespace mongo {
// transactional context for read locks. Not owned by us
OperationContext* _txn;
+ // Not owned here. Must be non-null.
Collection* _collection;
// Not owned here.