diff options
40 files changed, 309 insertions, 344 deletions
diff --git a/src/mongo/db/exec/and_hash.h b/src/mongo/db/exec/and_hash.h index b72a78fbeb8..9f42f93d5e1 100644 --- a/src/mongo/db/exec/and_hash.h +++ b/src/mongo/db/exec/and_hash.h @@ -49,7 +49,7 @@ namespace mongo { * operates with RecordIds, we are unable to evaluate the AND for the invalidated RecordId, and it * must be fully matched later. */ -class AndHashStage : public PlanStage { +class AndHashStage final : public PlanStage { public: AndHashStage(WorkingSet* ws, const Collection* collection); @@ -66,18 +66,18 @@ public: */ size_t getMemUsage() const; - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); + StageState work(WorkingSetID* out) final; + bool isEOF() final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_AND_HASH; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/and_sorted.h b/src/mongo/db/exec/and_sorted.h index b742a1090e3..ca6ea3e7410 100644 --- a/src/mongo/db/exec/and_sorted.h +++ b/src/mongo/db/exec/and_sorted.h @@ -51,24 +51,24 @@ namespace mongo { * operates with RecordIds, we are unable to evaluate the AND for the invalidated RecordId, and it * must be fully matched later. */ -class AndSortedStage : public PlanStage { +class AndSortedStage final : public PlanStage { public: AndSortedStage(WorkingSet* ws, const Collection* collection); void addChild(PlanStage* child); - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); + StageState work(WorkingSetID* out) final; + bool isEOF() final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_AND_SORTED; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/cached_plan.h b/src/mongo/db/exec/cached_plan.h index 7cf4a1ebc88..5216e33eac0 100644 --- a/src/mongo/db/exec/cached_plan.h +++ b/src/mongo/db/exec/cached_plan.h @@ -51,7 +51,7 @@ class PlanYieldPolicy; * Preconditions: Valid RecordId. * */ -class CachedPlanStage : public PlanStage { +class CachedPlanStage final : public PlanStage { public: CachedPlanStage(OperationContext* txn, Collection* collection, @@ -61,20 +61,20 @@ public: size_t decisionWorks, PlanStage* root); - virtual bool isEOF(); + bool isEOF() final; - virtual StageState work(WorkingSetID* out); + StageState work(WorkingSetID* out) final; - virtual void doReattachToOperationContext(OperationContext* opCtx); - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doReattachToOperationContext(OperationContext* opCtx) final; + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_CACHED_PLAN; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/collection_scan.h b/src/mongo/db/exec/collection_scan.h index e08d583a7a3..2cfac584456 100644 --- a/src/mongo/db/exec/collection_scan.h +++ b/src/mongo/db/exec/collection_scan.h @@ -47,29 +47,29 @@ class OperationContext; * * Preconditions: Valid RecordId. */ -class CollectionScan : public PlanStage { +class CollectionScan final : public PlanStage { public: CollectionScan(OperationContext* txn, const CollectionScanParams& params, WorkingSet* workingSet, const MatchExpression* filter); - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); + StageState work(WorkingSetID* out) final; + bool isEOF() final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_COLLSCAN; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/count.h b/src/mongo/db/exec/count.h index 110c9923119..b84f0bbe498 100644 --- a/src/mongo/db/exec/count.h +++ b/src/mongo/db/exec/count.h @@ -45,7 +45,7 @@ namespace mongo { * Only returns NEED_TIME until hitting EOF. The count result can be obtained by examining * the specific stats. */ -class CountStage : public PlanStage { +class CountStage final : public PlanStage { public: CountStage(OperationContext* txn, Collection* collection, @@ -53,18 +53,18 @@ public: WorkingSet* ws, PlanStage* child); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_COUNT; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/count_scan.h b/src/mongo/db/exec/count_scan.h index dbbd85c5715..f7f65700134 100644 --- a/src/mongo/db/exec/count_scan.h +++ b/src/mongo/db/exec/count_scan.h @@ -64,25 +64,25 @@ struct CountScanParams { * Only created through the getExecutorCount path, as count is the only operation that doesn't * care about its data. */ -class CountScan : public PlanStage { +class CountScan final : public PlanStage { public: CountScan(OperationContext* txn, const CountScanParams& params, WorkingSet* workingSet); - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + StageState work(WorkingSetID* out) final; + bool isEOF() final; + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_COUNT_SCAN; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/delete.h b/src/mongo/db/exec/delete.h index 1b85a37474d..528bad31088 100644 --- a/src/mongo/db/exec/delete.h +++ b/src/mongo/db/exec/delete.h @@ -76,7 +76,7 @@ struct DeleteStageParams { * Callers of work() must be holding a write lock (and, for shouldCallLogOp=true deletes, * callers must have had the replication coordinator approve the write). */ -class DeleteStage : public PlanStage { +class DeleteStage final : public PlanStage { MONGO_DISALLOW_COPYING(DeleteStage); public: @@ -86,19 +86,19 @@ public: Collection* collection, PlanStage* child); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doRestoreState(); - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doRestoreState() final; + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_DELETE; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/distinct_scan.h b/src/mongo/db/exec/distinct_scan.h index 36b20477a24..6caafeae2ff 100644 --- a/src/mongo/db/exec/distinct_scan.h +++ b/src/mongo/db/exec/distinct_scan.h @@ -72,25 +72,24 @@ struct DistinctParams { * * Only created through the getExecutorDistinct path. See db/query/get_executor.cpp */ -class DistinctScan : public PlanStage { +class DistinctScan final : public PlanStage { public: DistinctScan(OperationContext* txn, const DistinctParams& params, WorkingSet* workingSet); - virtual ~DistinctScan() {} - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); + StageState work(WorkingSetID* out) final; + bool isEOF() final; + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_DISTINCT_SCAN; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/eof.h b/src/mongo/db/exec/eof.h index 30df7679ba1..33462ca3aa9 100644 --- a/src/mongo/db/exec/eof.h +++ b/src/mongo/db/exec/eof.h @@ -36,23 +36,23 @@ namespace mongo { /** * This stage just returns EOF immediately. */ -class EOFStage : public PlanStage { +class EOFStage final : public PlanStage { public: EOFStage(); - virtual ~EOFStage(); + ~EOFStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_EOF; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; }; diff --git a/src/mongo/db/exec/fetch.h b/src/mongo/db/exec/fetch.h index 4e1bffcdeda..4cb2c37bca4 100644 --- a/src/mongo/db/exec/fetch.h +++ b/src/mongo/db/exec/fetch.h @@ -55,24 +55,24 @@ public: const MatchExpression* filter, const Collection* collection); - virtual ~FetchStage(); + ~FetchStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_FETCH; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/filter.h b/src/mongo/db/exec/filter.h index e23e116dfd9..40e1af14b1c 100644 --- a/src/mongo/db/exec/filter.h +++ b/src/mongo/db/exec/filter.h @@ -42,7 +42,6 @@ namespace mongo { class WorkingSetMatchableDocument : public MatchableDocument { public: WorkingSetMatchableDocument(WorkingSetMember* wsm) : _wsm(wsm) {} - virtual ~WorkingSetMatchableDocument() {} // This is only called by a $where query. The query system must be smart enough to realize // that it should do a fetch beforehand. @@ -51,7 +50,7 @@ public: return _wsm->obj.value(); } - virtual ElementIterator* allocateIterator(const ElementPath* path) const { + ElementIterator* allocateIterator(const ElementPath* path) const final { // BSONElementIterator does some interesting things with arrays that I don't think // SimpleArrayElementIterator does. if (_wsm->hasObj()) { @@ -89,7 +88,7 @@ public: return new SingleElementElementIterator(BSONElement()); } - virtual void releaseIterator(ElementIterator* iterator) const { + void releaseIterator(ElementIterator* iterator) const final { delete iterator; } @@ -106,7 +105,7 @@ public: return _key; } - virtual ElementIterator* allocateIterator(const ElementPath* path) const { + ElementIterator* allocateIterator(const ElementPath* path) const final { BSONObjIterator keyPatternIt(_keyPattern); BSONObjIterator keyDataIt(_key); @@ -132,7 +131,7 @@ public: return new SingleElementElementIterator(BSONElement()); } - virtual void releaseIterator(ElementIterator* iterator) const { + void releaseIterator(ElementIterator* iterator) const final { delete iterator; } diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp index a91b7e49583..db8f8daaa82 100644 --- a/src/mongo/db/exec/geo_near.cpp +++ b/src/mongo/db/exec/geo_near.cpp @@ -459,13 +459,11 @@ public: initPath(twoDPath); } - virtual ~TwoDPtInAnnulusExpression() {} - - virtual void toBSON(BSONObjBuilder* out) const { + void toBSON(BSONObjBuilder* out) const final { out->append("TwoDPtInAnnulusExpression", true); } - virtual bool matchesSingleElement(const BSONElement& e) const { + bool matchesSingleElement(const BSONElement& e) const final { if (!e.isABSONObj()) return false; @@ -480,16 +478,16 @@ public: // These won't be called. // - virtual void debugString(StringBuilder& debug, int level = 0) const { + void debugString(StringBuilder& debug, int level = 0) const final { invariant(false); } - virtual bool equivalent(const MatchExpression* other) const { + bool equivalent(const MatchExpression* other) const final { invariant(false); return false; } - virtual unique_ptr<MatchExpression> shallowClone() const { + unique_ptr<MatchExpression> shallowClone() const final { invariant(false); return NULL; } @@ -499,7 +497,7 @@ private: }; // Helper class to maintain ownership of a match expression alongside an index scan -class FetchStageWithMatch : public FetchStage { +class FetchStageWithMatch final : public FetchStage { public: FetchStageWithMatch(OperationContext* txn, WorkingSet* ws, @@ -508,8 +506,6 @@ public: const Collection* collection) : FetchStage(txn, ws, child, filter, collection), _matcher(filter) {} - virtual ~FetchStageWithMatch() {} - private: // Owns matcher const unique_ptr<MatchExpression> _matcher; diff --git a/src/mongo/db/exec/geo_near.h b/src/mongo/db/exec/geo_near.h index e429a742197..0bfcdb02090 100644 --- a/src/mongo/db/exec/geo_near.h +++ b/src/mongo/db/exec/geo_near.h @@ -63,7 +63,7 @@ struct GeoNearParams { /** * Implementation of GeoNear on top of a 2D index */ -class GeoNear2DStage : public NearStage { +class GeoNear2DStage final : public NearStage { public: GeoNear2DStage(const GeoNearParams& nearParams, OperationContext* txn, @@ -72,16 +72,16 @@ public: IndexDescriptor* twoDIndex); protected: - virtual StatusWith<CoveredInterval*> nextInterval(OperationContext* txn, - WorkingSet* workingSet, - Collection* collection); + StatusWith<CoveredInterval*> nextInterval(OperationContext* txn, + WorkingSet* workingSet, + Collection* collection) final; - virtual StatusWith<double> computeDistance(WorkingSetMember* member); + StatusWith<double> computeDistance(WorkingSetMember* member) final; - virtual PlanStage::StageState initialize(OperationContext* txn, - WorkingSet* workingSet, - Collection* collection, - WorkingSetID* out); + PlanStage::StageState initialize(OperationContext* txn, + WorkingSet* workingSet, + Collection* collection, + WorkingSetID* out) final; private: const GeoNearParams _nearParams; @@ -109,7 +109,7 @@ private: /** * Implementation of GeoNear on top of a 2DSphere (S2) index */ -class GeoNear2DSphereStage : public NearStage { +class GeoNear2DSphereStage final : public NearStage { public: GeoNear2DSphereStage(const GeoNearParams& nearParams, OperationContext* txn, @@ -117,19 +117,19 @@ public: Collection* collection, IndexDescriptor* s2Index); - virtual ~GeoNear2DSphereStage(); + ~GeoNear2DSphereStage(); protected: - virtual StatusWith<CoveredInterval*> nextInterval(OperationContext* txn, - WorkingSet* workingSet, - Collection* collection); + StatusWith<CoveredInterval*> nextInterval(OperationContext* txn, + WorkingSet* workingSet, + Collection* collection) final; - virtual StatusWith<double> computeDistance(WorkingSetMember* member); + StatusWith<double> computeDistance(WorkingSetMember* member) final; - virtual PlanStage::StageState initialize(OperationContext* txn, - WorkingSet* workingSet, - Collection* collection, - WorkingSetID* out); + PlanStage::StageState initialize(OperationContext* txn, + WorkingSet* workingSet, + Collection* collection, + WorkingSetID* out) final; private: const GeoNearParams _nearParams; diff --git a/src/mongo/db/exec/group.h b/src/mongo/db/exec/group.h index 97fb39d27e7..ce969c9335f 100644 --- a/src/mongo/db/exec/group.h +++ b/src/mongo/db/exec/group.h @@ -78,7 +78,7 @@ struct GroupRequest { * * Only created through the getExecutorGroup path. */ -class GroupStage : public PlanStage { +class GroupStage final : public PlanStage { MONGO_DISALLOW_COPYING(GroupStage); public: @@ -86,19 +86,18 @@ public: const GroupRequest& request, WorkingSet* workingSet, PlanStage* child); - virtual ~GroupStage() {} - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); - virtual void doReattachToOperationContext(OperationContext* opCtx); + StageState work(WorkingSetID* out) final; + bool isEOF() final; + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_GROUP; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/idhack.h b/src/mongo/db/exec/idhack.h index 19b12cbbc09..71f783431a1 100644 --- a/src/mongo/db/exec/idhack.h +++ b/src/mongo/db/exec/idhack.h @@ -43,7 +43,7 @@ class RecordCursor; * A standalone stage implementing the fast path for key-value retrievals * via the _id index. */ -class IDHackStage : public PlanStage { +class IDHackStage final : public PlanStage { public: /** Takes ownership of all the arguments -collection. */ IDHackStage(OperationContext* txn, @@ -53,29 +53,29 @@ public: IDHackStage(OperationContext* txn, Collection* collection, const BSONObj& key, WorkingSet* ws); - virtual ~IDHackStage(); + ~IDHackStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; /** * ID Hack has a very strict criteria for the queries it supports. */ static bool supportsQuery(const CanonicalQuery& query); - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_IDHACK; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/index_scan.h b/src/mongo/db/exec/index_scan.h index 5ae2319800c..aae3d54ec4c 100644 --- a/src/mongo/db/exec/index_scan.h +++ b/src/mongo/db/exec/index_scan.h @@ -70,7 +70,7 @@ struct IndexScanParams { * * Sub-stage preconditions: None. Is a leaf and consumes no stage data. */ -class IndexScan : public PlanStage { +class IndexScan final : public PlanStage { public: /** * Keeps track of what this index scan is currently doing so that it @@ -95,23 +95,21 @@ public: WorkingSet* workingSet, const MatchExpression* filter); - virtual ~IndexScan() {} + StageState work(WorkingSetID* out) final; + bool isEOF() final; + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); - - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_IXSCAN; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/keep_mutations.h b/src/mongo/db/exec/keep_mutations.h index d76ba32dac8..67ff15afca1 100644 --- a/src/mongo/db/exec/keep_mutations.h +++ b/src/mongo/db/exec/keep_mutations.h @@ -44,21 +44,21 @@ namespace mongo { * results when possible. The query planner is responsible for determining when it's valid to * merge these results. */ -class KeepMutationsStage : public PlanStage { +class KeepMutationsStage final : public PlanStage { public: KeepMutationsStage(const MatchExpression* filter, WorkingSet* ws, PlanStage* child); - virtual ~KeepMutationsStage(); + ~KeepMutationsStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_KEEP_MUTATIONS; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/limit.h b/src/mongo/db/exec/limit.h index 33af499d5f8..de8d1ae2598 100644 --- a/src/mongo/db/exec/limit.h +++ b/src/mongo/db/exec/limit.h @@ -42,21 +42,21 @@ namespace mongo { * * Preconditions: None. */ -class LimitStage : public PlanStage { +class LimitStage final : public PlanStage { public: LimitStage(long long limit, WorkingSet* ws, PlanStage* child); - virtual ~LimitStage(); + ~LimitStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_LIMIT; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/merge_sort.h b/src/mongo/db/exec/merge_sort.h index 51114bbd0ca..ed9fd2f2a11 100644 --- a/src/mongo/db/exec/merge_sort.h +++ b/src/mongo/db/exec/merge_sort.h @@ -53,7 +53,7 @@ class MergeSortStageParams; * Preconditions: For each field in 'pattern' all inputs in the child must handle a * getFieldDotted for that field. */ -class MergeSortStage : public PlanStage { +class MergeSortStage final : public PlanStage { public: MergeSortStage(const MergeSortStageParams& params, WorkingSet* ws, @@ -61,18 +61,18 @@ public: void addChild(PlanStage* child); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_SORT_MERGE; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/multi_iterator.h b/src/mongo/db/exec/multi_iterator.h index 9bcbdb3c1c1..9d67d29abaa 100644 --- a/src/mongo/db/exec/multi_iterator.h +++ b/src/mongo/db/exec/multi_iterator.h @@ -45,36 +45,34 @@ namespace mongo { * special commands that work with RecordCursors. For example, it is used by the * parallelCollectionScan and repairCursor commands */ -class MultiIteratorStage : public PlanStage { +class MultiIteratorStage final : public PlanStage { public: MultiIteratorStage(OperationContext* txn, WorkingSet* ws, Collection* collection); - ~MultiIteratorStage() {} - void addIterator(std::unique_ptr<RecordCursor> it); - virtual PlanStage::StageState work(WorkingSetID* out); + PlanStage::StageState work(WorkingSetID* out) final; - virtual bool isEOF(); + bool isEOF() final; void kill(); - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; // Returns empty PlanStageStats object - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; // Not used. - virtual SpecificStats* getSpecificStats() const { + SpecificStats* getSpecificStats() const final { return NULL; } // Not used. - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_MULTI_ITERATOR; } diff --git a/src/mongo/db/exec/multi_plan.h b/src/mongo/db/exec/multi_plan.h index 30b5f5f9bbf..85cc3191d13 100644 --- a/src/mongo/db/exec/multi_plan.h +++ b/src/mongo/db/exec/multi_plan.h @@ -49,7 +49,7 @@ namespace mongo { * * Owns the query solutions and PlanStage roots for all candidate plans. */ -class MultiPlanStage : public PlanStage { +class MultiPlanStage final : public PlanStage { public: /** * Takes no ownership. @@ -62,22 +62,22 @@ public: CanonicalQuery* cq, bool shouldCache = true); - virtual bool isEOF(); + bool isEOF() final; - virtual StageState work(WorkingSetID* out); + StageState work(WorkingSetID* out) final; - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_MULTI_PLAN; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; /** * Takes ownership of QuerySolution and PlanStage. not of WorkingSet diff --git a/src/mongo/db/exec/near.h b/src/mongo/db/exec/near.h index 20603cc5e50..1a10d9143da 100644 --- a/src/mongo/db/exec/near.h +++ b/src/mongo/db/exec/near.h @@ -87,17 +87,17 @@ class NearStage : public PlanStage { public: struct CoveredInterval; - virtual ~NearStage(); + ~NearStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doReattachToOperationContext(OperationContext* opCtx); - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doReattachToOperationContext(OperationContext* opCtx) final; + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const; - virtual std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + StageType stageType() const final; + std::unique_ptr<PlanStageStats> getStats() final; + const SpecificStats* getSpecificStats() const final; protected: /** diff --git a/src/mongo/db/exec/oplogstart.h b/src/mongo/db/exec/oplogstart.h index 14db9e9b585..033f51a8c9d 100644 --- a/src/mongo/db/exec/oplogstart.h +++ b/src/mongo/db/exec/oplogstart.h @@ -58,7 +58,7 @@ namespace mongo { * Why is this a stage? Because we want to yield, and we want to be notified of RecordId * invalidations. :( */ -class OplogStart : public PlanStage { +class OplogStart final : public PlanStage { public: // Does not take ownership. OplogStart(OperationContext* txn, @@ -66,27 +66,27 @@ public: MatchExpression* filter, WorkingSet* ws); - virtual StageState work(WorkingSetID* out); - virtual bool isEOF(); + StageState work(WorkingSetID* out) final; + bool isEOF() final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); - virtual void doSaveState(); - virtual void doRestoreState(); - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; + void doSaveState() final; + void doRestoreState() final; + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; // Returns empty PlanStageStats object - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; // // Exec stats -- do not call for the oplog start stage. // - virtual const SpecificStats* getSpecificStats() const { + const SpecificStats* getSpecificStats() const final { return NULL; } - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_OPLOG_START; } diff --git a/src/mongo/db/exec/or.h b/src/mongo/db/exec/or.h index 7a10a78ae7d..d0fd1a33209 100644 --- a/src/mongo/db/exec/or.h +++ b/src/mongo/db/exec/or.h @@ -43,25 +43,25 @@ namespace mongo { * * If we're deduping, we may fail to dedup any invalidated RecordId properly. */ -class OrStage : public PlanStage { +class OrStage final : public PlanStage { public: OrStage(WorkingSet* ws, bool dedup, const MatchExpression* filter); void addChild(PlanStage* child); - virtual bool isEOF(); + bool isEOF() final; - virtual StageState work(WorkingSetID* out); + StageState work(WorkingSetID* out) final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_OR; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/pipeline_proxy.h b/src/mongo/db/exec/pipeline_proxy.h index 84f1a867f2e..a67d993d4a3 100644 --- a/src/mongo/db/exec/pipeline_proxy.h +++ b/src/mongo/db/exec/pipeline_proxy.h @@ -42,23 +42,23 @@ namespace mongo { /** * Stage for pulling results out from an aggregation pipeline. */ -class PipelineProxyStage : public PlanStage { +class PipelineProxyStage final : public PlanStage { public: PipelineProxyStage(boost::intrusive_ptr<Pipeline> pipeline, const std::shared_ptr<PlanExecutor>& child, WorkingSet* ws); - virtual PlanStage::StageState work(WorkingSetID* out); + PlanStage::StageState work(WorkingSetID* out) final; - virtual bool isEOF(); + bool isEOF() final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; // // Manage our OperationContext. // - virtual void doDetachFromOperationContext(); - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doDetachFromOperationContext() final; + void doReattachToOperationContext(OperationContext* opCtx) final; /** * Make obj the next object returned by getNext(). @@ -72,16 +72,16 @@ public: std::shared_ptr<PlanExecutor> getChildExecutor(); // Returns empty PlanStageStats object - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; // Not used. - virtual SpecificStats* getSpecificStats() const { + SpecificStats* getSpecificStats() const final { return NULL; } // Not used. - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_PIPELINE_PROXY; } diff --git a/src/mongo/db/exec/plan_stats.h b/src/mongo/db/exec/plan_stats.h index 82f8cbc7e10..67e3250d8ec 100644 --- a/src/mongo/db/exec/plan_stats.h +++ b/src/mongo/db/exec/plan_stats.h @@ -146,9 +146,7 @@ private: struct AndHashStats : public SpecificStats { AndHashStats() : flaggedButPassed(0), flaggedInProgress(0), memUsage(0), memLimit(0) {} - virtual ~AndHashStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { AndHashStats* specific = new AndHashStats(*this); return specific; } @@ -178,9 +176,7 @@ struct AndHashStats : public SpecificStats { struct AndSortedStats : public SpecificStats { AndSortedStats() : flagged(0) {} - virtual ~AndSortedStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { AndSortedStats* specific = new AndSortedStats(*this); return specific; } @@ -195,7 +191,7 @@ struct AndSortedStats : public SpecificStats { struct CachedPlanStats : public SpecificStats { CachedPlanStats() {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { return new CachedPlanStats(*this); } }; @@ -203,7 +199,7 @@ struct CachedPlanStats : public SpecificStats { struct CollectionScanStats : public SpecificStats { CollectionScanStats() : docsTested(0), direction(1) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { CollectionScanStats* specific = new CollectionScanStats(*this); return specific; } @@ -219,7 +215,7 @@ struct CollectionScanStats : public SpecificStats { struct CountStats : public SpecificStats { CountStats() : nCounted(0), nSkipped(0), trivialCount(false) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { CountStats* specific = new CountStats(*this); return specific; } @@ -244,9 +240,7 @@ struct CountScanStats : public SpecificStats { isUnique(false), keysExamined(0) {} - virtual ~CountScanStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { CountScanStats* specific = new CountScanStats(*this); // BSON objects have to be explicitly copied. specific->keyPattern = keyPattern.getOwned(); @@ -270,7 +264,7 @@ struct CountScanStats : public SpecificStats { struct DeleteStats : public SpecificStats { DeleteStats() : docsDeleted(0), nInvalidateSkips(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { return new DeleteStats(*this); } @@ -284,7 +278,7 @@ struct DeleteStats : public SpecificStats { struct DistinctScanStats : public SpecificStats { DistinctScanStats() : keysExamined(0), indexVersion(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { DistinctScanStats* specific = new DistinctScanStats(*this); specific->keyPattern = keyPattern.getOwned(); return specific; @@ -303,9 +297,7 @@ struct DistinctScanStats : public SpecificStats { struct FetchStats : public SpecificStats { FetchStats() : alreadyHasObj(0), forcedFetches(0), docsExamined(0) {} - virtual ~FetchStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { FetchStats* specific = new FetchStats(*this); return specific; } @@ -323,9 +315,7 @@ struct FetchStats : public SpecificStats { struct GroupStats : public SpecificStats { GroupStats() : nGroups(0) {} - virtual ~GroupStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { GroupStats* specific = new GroupStats(*this); return specific; } @@ -337,9 +327,7 @@ struct GroupStats : public SpecificStats { struct IDHackStats : public SpecificStats { IDHackStats() : keysExamined(0), docsExamined(0) {} - virtual ~IDHackStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { IDHackStats* specific = new IDHackStats(*this); return specific; } @@ -364,9 +352,7 @@ struct IndexScanStats : public SpecificStats { seenInvalidated(0), keysExamined(0) {} - virtual ~IndexScanStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { IndexScanStats* specific = new IndexScanStats(*this); // BSON objects have to be explicitly copied. specific->keyPattern = keyPattern.getOwned(); @@ -412,7 +398,7 @@ struct IndexScanStats : public SpecificStats { struct LimitStats : public SpecificStats { LimitStats() : limit(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { LimitStats* specific = new LimitStats(*this); return specific; } @@ -423,7 +409,7 @@ struct LimitStats : public SpecificStats { struct MockStats : public SpecificStats { MockStats() {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { return new MockStats(*this); } }; @@ -431,7 +417,7 @@ struct MockStats : public SpecificStats { struct MultiPlanStats : public SpecificStats { MultiPlanStats() {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { return new MultiPlanStats(*this); } }; @@ -439,9 +425,7 @@ struct MultiPlanStats : public SpecificStats { struct OrStats : public SpecificStats { OrStats() : dupsTested(0), dupsDropped(0), locsForgotten(0) {} - virtual ~OrStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { OrStats* specific = new OrStats(*this); return specific; } @@ -456,7 +440,7 @@ struct OrStats : public SpecificStats { struct ProjectionStats : public SpecificStats { ProjectionStats() {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { ProjectionStats* specific = new ProjectionStats(*this); return specific; } @@ -468,9 +452,7 @@ struct ProjectionStats : public SpecificStats { struct SortStats : public SpecificStats { SortStats() : forcedFetches(0), memUsage(0), memLimit(0) {} - virtual ~SortStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { SortStats* specific = new SortStats(*this); return specific; } @@ -494,9 +476,7 @@ struct SortStats : public SpecificStats { struct MergeSortStats : public SpecificStats { MergeSortStats() : dupsTested(0), dupsDropped(0), forcedFetches(0) {} - virtual ~MergeSortStats() {} - - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { MergeSortStats* specific = new MergeSortStats(*this); return specific; } @@ -514,7 +494,7 @@ struct MergeSortStats : public SpecificStats { struct ShardingFilterStats : public SpecificStats { ShardingFilterStats() : chunkSkips(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { ShardingFilterStats* specific = new ShardingFilterStats(*this); return specific; } @@ -525,7 +505,7 @@ struct ShardingFilterStats : public SpecificStats { struct SkipStats : public SpecificStats { SkipStats() : skip(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { SkipStats* specific = new SkipStats(*this); return specific; } @@ -562,7 +542,7 @@ class NearStats : public SpecificStats { public: NearStats() {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { return new NearStats(*this); } @@ -591,7 +571,7 @@ struct UpdateStats : public SpecificStats { inserted(false), nInvalidateSkips(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { return new UpdateStats(*this); } @@ -629,7 +609,7 @@ struct UpdateStats : public SpecificStats { struct TextStats : public SpecificStats { TextStats() : parsedTextQuery() {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { TextStats* specific = new TextStats(*this); return specific; } @@ -646,7 +626,7 @@ struct TextStats : public SpecificStats { struct TextMatchStats : public SpecificStats { TextMatchStats() : docsRejected(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { TextMatchStats* specific = new TextMatchStats(*this); return specific; } @@ -657,7 +637,7 @@ struct TextMatchStats : public SpecificStats { struct TextOrStats : public SpecificStats { TextOrStats() : fetches(0) {} - virtual SpecificStats* clone() const { + SpecificStats* clone() const final { TextOrStats* specific = new TextOrStats(*this); return specific; } diff --git a/src/mongo/db/exec/projection.h b/src/mongo/db/exec/projection.h index 7fa5f0fcc2d..58588b3c1dc 100644 --- a/src/mongo/db/exec/projection.h +++ b/src/mongo/db/exec/projection.h @@ -73,20 +73,20 @@ struct ProjectionStageParams { /** * This stage computes a projection. */ -class ProjectionStage : public PlanStage { +class ProjectionStage final : public PlanStage { public: ProjectionStage(const ProjectionStageParams& params, WorkingSet* ws, PlanStage* child); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_PROJECTION; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; typedef unordered_set<StringData, StringData::Hasher> FieldSet; diff --git a/src/mongo/db/exec/queued_data_stage.h b/src/mongo/db/exec/queued_data_stage.h index cceaaf10457..a3e57f6101f 100644 --- a/src/mongo/db/exec/queued_data_stage.h +++ b/src/mongo/db/exec/queued_data_stage.h @@ -45,15 +45,15 @@ class RecordId; * queue. Calls to QueuedDataStage::work() pop values off that queue and return them in FIFO * order, annotating the working set with data when appropriate. */ -class QueuedDataStage : public PlanStage { +class QueuedDataStage final : public PlanStage { public: QueuedDataStage(WorkingSet* ws); - virtual StageState work(WorkingSetID* out); + StageState work(WorkingSetID* out) final; - virtual bool isEOF(); + bool isEOF() final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_QUEUED_DATA; } @@ -61,9 +61,9 @@ public: // Exec stats // - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; /** * Add a result to the back of the queue. diff --git a/src/mongo/db/exec/shard_filter.h b/src/mongo/db/exec/shard_filter.h index be3f98d526b..393cdbe8975 100644 --- a/src/mongo/db/exec/shard_filter.h +++ b/src/mongo/db/exec/shard_filter.h @@ -69,23 +69,23 @@ class CollectionMetadata; * Preconditions: Child must be fetched. TODO: when covering analysis is in just build doc * and check that against shard key. See SERVER-5022. */ -class ShardFilterStage : public PlanStage { +class ShardFilterStage final : public PlanStage { public: ShardFilterStage(const std::shared_ptr<CollectionMetadata>& metadata, WorkingSet* ws, PlanStage* child); - virtual ~ShardFilterStage(); + ~ShardFilterStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_SHARDING_FILTER; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/skip.h b/src/mongo/db/exec/skip.h index 3d2b165abd8..45e01bbd120 100644 --- a/src/mongo/db/exec/skip.h +++ b/src/mongo/db/exec/skip.h @@ -41,21 +41,21 @@ namespace mongo { * * Preconditions: None. */ -class SkipStage : public PlanStage { +class SkipStage final : public PlanStage { public: SkipStage(long long toSkip, WorkingSet* ws, PlanStage* child); - virtual ~SkipStage(); + ~SkipStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_SKIP; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/sort.h b/src/mongo/db/exec/sort.h index 39a32ba9c88..f0a29b84efc 100644 --- a/src/mongo/db/exec/sort.h +++ b/src/mongo/db/exec/sort.h @@ -139,23 +139,23 @@ private: * Preconditions: For each field in 'pattern', all inputs in the child must handle a * getFieldDotted for that field. */ -class SortStage : public PlanStage { +class SortStage final : public PlanStage { public: SortStage(const SortStageParams& params, WorkingSet* ws, PlanStage* child); - virtual ~SortStage(); + ~SortStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + void doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_SORT; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/subplan.h b/src/mongo/db/exec/subplan.h index f85ce59b542..47b54eea46f 100644 --- a/src/mongo/db/exec/subplan.h +++ b/src/mongo/db/exec/subplan.h @@ -64,7 +64,7 @@ class OperationContext; * * --Plans for entire rooted $or queries are neither written to nor read from the plan cache. */ -class SubplanStage : public PlanStage { +class SubplanStage final : public PlanStage { public: SubplanStage(OperationContext* txn, Collection* collection, @@ -74,18 +74,18 @@ public: static bool canUseSubplanning(const CanonicalQuery& query); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_SUBPLAN; } std::unique_ptr<PlanStageStats> getStats(); - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/text.h b/src/mongo/db/exec/text.h index 4d0d57f66d0..e0636422eff 100644 --- a/src/mongo/db/exec/text.h +++ b/src/mongo/db/exec/text.h @@ -69,7 +69,7 @@ struct TextStageParams { * * Output type: LOC_AND_OBJ. */ -class TextStage : public PlanStage { +class TextStage final : public PlanStage { public: TextStage(OperationContext* txn, const TextStageParams& params, diff --git a/src/mongo/db/exec/text_match.h b/src/mongo/db/exec/text_match.h index cacec80c4e6..df3e3b9ae68 100644 --- a/src/mongo/db/exec/text_match.h +++ b/src/mongo/db/exec/text_match.h @@ -61,7 +61,7 @@ public: const FTSQuery& query, const FTSSpec& spec, WorkingSet* ws); - ~TextMatchStage() final; + ~TextMatchStage(); void addChild(PlanStage* child); diff --git a/src/mongo/db/exec/text_or.cpp b/src/mongo/db/exec/text_or.cpp index 41c57530a19..bbdbabdd4d0 100644 --- a/src/mongo/db/exec/text_or.cpp +++ b/src/mongo/db/exec/text_or.cpp @@ -297,7 +297,7 @@ public: return getObj(); } - virtual ElementIterator* allocateIterator(const ElementPath* path) const { + ElementIterator* allocateIterator(const ElementPath* path) const final { WorkingSetMember* member = _ws->get(_id); if (!member->hasObj()) { // Try to look in the key. @@ -323,7 +323,7 @@ public: return new BSONElementIterator(path, getObj()); } - virtual void releaseIterator(ElementIterator* iterator) const { + void releaseIterator(ElementIterator* iterator) const final { delete iterator; } diff --git a/src/mongo/db/exec/text_or.h b/src/mongo/db/exec/text_or.h index c2018bda166..5d9df26f439 100644 --- a/src/mongo/db/exec/text_or.h +++ b/src/mongo/db/exec/text_or.h @@ -78,7 +78,7 @@ public: WorkingSet* ws, const MatchExpression* filter, IndexDescriptor* index); - ~TextOrStage() final; + ~TextOrStage(); void addChild(unique_ptr<PlanStage> child); diff --git a/src/mongo/db/exec/update.h b/src/mongo/db/exec/update.h index c728bda5392..87859c9ff5f 100644 --- a/src/mongo/db/exec/update.h +++ b/src/mongo/db/exec/update.h @@ -71,7 +71,7 @@ private: * * Callers of work() must be holding a write lock. */ -class UpdateStage : public PlanStage { +class UpdateStage final : public PlanStage { MONGO_DISALLOW_COPYING(UpdateStage); public: @@ -81,19 +81,19 @@ public: Collection* collection, PlanStage* child); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + bool isEOF() final; + StageState work(WorkingSetID* out) final; - virtual void doRestoreState(); - virtual void doReattachToOperationContext(OperationContext* opCtx); + void doRestoreState() final; + void doReattachToOperationContext(OperationContext* opCtx) final; - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_UPDATE; } - virtual std::unique_ptr<PlanStageStats> getStats(); + std::unique_ptr<PlanStageStats> getStats() final; - virtual const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const final; static const char* kStageType; diff --git a/src/mongo/db/exec/working_set_computed_data.h b/src/mongo/db/exec/working_set_computed_data.h index c7dc27ce45d..9c948e7912b 100644 --- a/src/mongo/db/exec/working_set_computed_data.h +++ b/src/mongo/db/exec/working_set_computed_data.h @@ -41,7 +41,7 @@ public: return _score; } - virtual TextScoreComputedData* clone() const { + TextScoreComputedData* clone() const final { return new TextScoreComputedData(_score); } @@ -58,7 +58,7 @@ public: return _dist; } - virtual GeoDistanceComputedData* clone() const { + GeoDistanceComputedData* clone() const final { return new GeoDistanceComputedData(_dist); } @@ -75,7 +75,7 @@ public: return _key; } - virtual IndexKeyComputedData* clone() const { + IndexKeyComputedData* clone() const final { return new IndexKeyComputedData(_key); } @@ -92,7 +92,7 @@ public: return _point; } - virtual GeoNearPointComputedData* clone() const { + GeoNearPointComputedData* clone() const final { return new GeoNearPointComputedData(_point); } diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index 0e9d14d5f22..ef7250393fe 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -81,19 +81,19 @@ public: MONGO_UNREACHABLE; } - virtual bool isEOF() { + bool isEOF() final { MONGO_UNREACHABLE; } - virtual unique_ptr<PlanStageStats> getStats() { + unique_ptr<PlanStageStats> getStats() final { MONGO_UNREACHABLE; } - virtual SpecificStats* getSpecificStats() const { + SpecificStats* getSpecificStats() const final { MONGO_UNREACHABLE; } - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_NOTIFY_DELETE; } diff --git a/src/mongo/dbtests/query_stage_near.cpp b/src/mongo/dbtests/query_stage_near.cpp index 3349f0b872a..7e89b0900c5 100644 --- a/src/mongo/dbtests/query_stage_near.cpp +++ b/src/mongo/dbtests/query_stage_near.cpp @@ -49,14 +49,12 @@ using stdx::make_unique; * Stage which takes in an array of BSONObjs and returns them. * If the BSONObj is in the form of a Status, returns the Status as a FAILURE. */ -class MockStage : public PlanStage { +class MockStage final : public PlanStage { public: MockStage(const vector<BSONObj>& data, WorkingSet* workingSet) : PlanStage("MOCK_STAGE"), _data(data), _pos(0), _workingSet(workingSet) {} - virtual ~MockStage() {} - - virtual StageState work(WorkingSetID* out) { + StageState work(WorkingSetID* out) final { ++_commonStats.works; if (isEOF()) @@ -78,19 +76,19 @@ public: return PlanStage::ADVANCED; } - virtual bool isEOF() { + bool isEOF() final { return _pos == static_cast<int>(_data.size()); } - virtual StageType stageType() const { + StageType stageType() const final { return STAGE_UNKNOWN; } - virtual unique_ptr<PlanStageStats> getStats() { + unique_ptr<PlanStageStats> getStats() final { return make_unique<PlanStageStats>(_commonStats, STAGE_UNKNOWN); } - virtual const SpecificStats* getSpecificStats() const { + const SpecificStats* getSpecificStats() const final { return NULL; } @@ -106,7 +104,7 @@ private: * Stage which implements a basic distance search, and interprets the "distance" field of * fetched documents as the distance. */ -class MockNearStage : public NearStage { +class MockNearStage final : public NearStage { public: struct MockInterval { MockInterval(const vector<BSONObj>& data, double min, double max) @@ -120,8 +118,6 @@ public: MockNearStage(WorkingSet* workingSet) : NearStage(NULL, "MOCK_DISTANCE_SEARCH_STAGE", STAGE_UNKNOWN, workingSet, NULL), _pos(0) {} - virtual ~MockNearStage() {} - void addInterval(vector<BSONObj> data, double min, double max) { _intervals.mutableVector().push_back(new MockInterval(data, min, max)); } @@ -140,7 +136,7 @@ public: _children.back().get(), true, interval.min, interval.max, lastInterval)); } - virtual StatusWith<double> computeDistance(WorkingSetMember* member) { + StatusWith<double> computeDistance(WorkingSetMember* member) final { ASSERT(member->hasObj()); return StatusWith<double>(member->obj.value()["distance"].numberDouble()); } |