diff options
author | David Storch <david.storch@10gen.com> | 2015-04-14 11:44:18 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-04-14 14:25:21 -0400 |
commit | 8bd99fa7bd4387abeb5f6ddf0907b36f67d9c702 (patch) | |
tree | ea33dba5b7dcf00252792aab0320b9f04ef83254 | |
parent | 7c1ad90880f8612fcc310ad329790464453cfbd9 (diff) | |
download | mongo-8bd99fa7bd4387abeb5f6ddf0907b36f67d9c702.tar.gz |
SERVER-17328 add invariant that collection is non-null to planning stages (CachedPlan/Subplan/MultiPlan)
-rw-r--r-- | src/mongo/db/exec/cached_plan.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/exec/cached_plan.h | 2 | ||||
-rw-r--r-- | src/mongo/db/exec/multi_plan.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/exec/multi_plan.h | 4 | ||||
-rw-r--r-- | src/mongo/db/exec/subplan.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/exec/subplan.h | 1 |
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. |