SERVER-127342 PlanStage etc use StringData (#54212)

GitOrigin-RevId: e5c1c7d16cce2b93c268777f97b6e45d836baed4
This commit is contained in:
Billy Donahue 2026-05-22 15:34:31 -04:00 committed by MongoDB Bot
parent 138419c76c
commit 460b5db2b9
73 changed files with 85 additions and 95 deletions

View File

@ -54,8 +54,6 @@ using std::unique_ptr;
const size_t AndHashStage::kLookAheadWorks = 10;
// static
const char* AndHashStage::kStageType = "AND_HASH";
AndHashStage::AndHashStage(ExpressionContext* expCtx, WorkingSet* ws)
: PlanStage(kStageType, expCtx),

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -79,7 +80,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "AND_HASH"_sd;
private:
static const size_t kLookAheadWorks;

View File

@ -42,8 +42,6 @@ namespace mongo {
using std::numeric_limits;
using std::unique_ptr;
// static
const char* AndSortedStage::kStageType = "AND_SORTED";
AndSortedStage::AndSortedStage(ExpressionContext* expCtx, WorkingSet* ws)
: PlanStage(kStageType, expCtx),

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -66,7 +67,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "AND_SORTED"_sd;
private:
// Find a node to AND against.

View File

@ -139,7 +139,7 @@ BatchedDeleteStage::BatchedDeleteStage(
WorkingSet* ws,
CollectionAcquisition collection,
PlanStage* child)
: DeleteStage::DeleteStage(kStageType.data(), expCtx, std::move(params), ws, collection, child),
: DeleteStage::DeleteStage(kStageType, expCtx, std::move(params), ws, collection, child),
_batchedDeleteParams(std::move(batchedDeleteParams)),
_stagedDeletesBuffer(ws),
_stagedDeletesWatermarkBytes(0),

View File

@ -67,8 +67,6 @@ MONGO_FAIL_POINT_DEFINE(planCacheAlwaysReplanClassic);
namespace mongo {
// static
const char* CachedPlanStage::kStageType = "CACHED_PLAN";
CachedPlanStage::CachedPlanStage(ExpressionContext* expCtx,
CollectionAcquisition collection,

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_all_indices_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -84,7 +85,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "CACHED_PLAN"_sd;
/**
* Runs the cached plan for a trial period, yielding during the trial period according to

View File

@ -38,8 +38,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* CountStage::kStageType = "COUNT";
CountStage::CountStage(
ExpressionContext* expCtx, long long limit, long long skip, WorkingSet* ws, PlanStage* child)

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -70,7 +71,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "COUNT"_sd;
long long getLimit() const {
return _limit;

View File

@ -81,8 +81,6 @@ bool isCompoundWildcardIndex(const IndexDescriptor* indexDescriptor) {
using std::unique_ptr;
// static
const char* CountScan::kStageType = "COUNT_SCAN";
// When building the CountScan stage we take the keyPattern, index name, and multikey details from
// the CountScanParams rather than resolving them via the IndexDescriptor, since these may differ

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/recordid_deduplicator.h"
@ -124,7 +125,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "COUNT_SCAN"_sd;
protected:
void doSaveStateRequiresIndex() final;

View File

@ -84,9 +84,9 @@ DeleteStage::DeleteStage(ExpressionContext* expCtx,
WorkingSet* ws,
CollectionAcquisition collection,
PlanStage* child)
: DeleteStage(kStageType.data(), expCtx, std::move(params), ws, collection, child) {}
: DeleteStage(kStageType, expCtx, std::move(params), ws, collection, child) {}
DeleteStage::DeleteStage(const char* stageType,
DeleteStage::DeleteStage(StringData stageType,
ExpressionContext* expCtx,
DeleteStageParams params,
WorkingSet* ws,

View File

@ -118,7 +118,7 @@ public:
CollectionAcquisition collection,
PlanStage* child);
DeleteStage(const char* stageType,
DeleteStage(StringData stageType,
ExpressionContext* expCtx,
DeleteStageParams params,
WorkingSet* ws,

View File

@ -56,8 +56,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* DistinctScan::kStageType = "DISTINCT_SCAN";
DistinctScan::DistinctScan(ExpressionContext* expCtx,
CollectionAcquisition collection,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/exec/classic/orphan_chunk_skipper.h"
#include "mongo/db/exec/classic/plan_stage.h"
@ -137,7 +138,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "DISTINCT_SCAN"_sd;
protected:
void doSaveStateRequiresIndex() final;

View File

@ -35,8 +35,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* EOFStage::kStageType = "EOF";
EOFStage::EOFStage(ExpressionContext* expCtx, eof_node::EOFType type)
: PlanStage(kStageType, expCtx), _specificStats(EofStats(type)) {}

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -62,7 +63,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "EOF"_sd;
private:
EofStats _specificStats;

View File

@ -48,8 +48,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* FetchStage::kStageType = "FETCH";
FetchStage::FetchStage(ExpressionContext* expCtx,
WorkingSet* ws,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_collection_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -78,7 +79,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "FETCH"_sd;
protected:
void doSaveStateRequiresCollection() final;

View File

@ -49,8 +49,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* IDHackStage::kStageType = "IDHACK";
IDHackStage::IDHackStage(ExpressionContext* expCtx,
const CanonicalQuery* query,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_index_stage.h"
@ -85,7 +86,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "IDHACK"_sd;
protected:
void doSaveStateRequiresIndex() final;

View File

@ -62,8 +62,6 @@ namespace mongo {
MONGO_FAIL_POINT_DEFINE(throwDuringIndexScanRestore);
// static
const char* IndexScan::kStageType = "IXSCAN";
IndexScan::IndexScan(ExpressionContext* expCtx,
CollectionAcquisition collection,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/recordid_deduplicator.h"
@ -151,7 +152,7 @@ public:
return &_specificStats;
}
static const char* kStageType;
static constexpr StringData kStageType = "IXSCAN"_sd;
const BSONObj& getKeyPattern() const {
return _keyPattern;

View File

@ -37,8 +37,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* LimitStage::kStageType = "LIMIT";
LimitStage::LimitStage(ExpressionContext* expCtx,
long long limit,

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -67,7 +68,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "LIMIT"_sd;
private:
// We only return this many results.

View File

@ -47,8 +47,6 @@ namespace mongo {
using std::string;
using std::unique_ptr;
// static
const char* MergeSortStage::kStageType = "SORT_MERGE";
MergeSortStage::MergeSortStage(ExpressionContext* expCtx,
const MergeSortStageParams& params,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/recordid_deduplicator.h"
@ -86,7 +87,7 @@ public:
return _memoryTracker;
}
static const char* kStageType;
static constexpr StringData kStageType = "SORT_MERGE"_sd;
private:
struct StageWithValue {

View File

@ -34,8 +34,7 @@
namespace mongo {
MockStage::MockStage(ExpressionContext* expCtx, WorkingSet*)
: PlanStage(kStageType.data(), expCtx) {}
MockStage::MockStage(ExpressionContext* expCtx, WorkingSet*) : PlanStage(kStageType, expCtx) {}
std::unique_ptr<PlanStageStats> MockStage::getStats() {
_commonStats.isEOF = isEOF();

View File

@ -45,7 +45,6 @@ namespace mongo {
using std::unique_ptr;
const char* MultiIteratorStage::kStageType = "MULTI_ITERATOR";
MultiIteratorStage::MultiIteratorStage(ExpressionContext* expCtx,
WorkingSet* ws,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_collection_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -76,7 +77,7 @@ public:
return STAGE_MULTI_ITERATOR;
}
static const char* kStageType;
static constexpr StringData kStageType = "MULTI_ITERATOR"_sd;
protected:
void doSaveStateRequiresCollection() final;

View File

@ -75,8 +75,6 @@ namespace mongo {
using namespace cost_based_ranker;
using std::unique_ptr;
// static
const char* MultiPlanStage::kStageType = "MULTI_PLAN";
namespace {
void markShouldCollectTimingInfoOnSubtree(PlanStage* root) {

View File

@ -31,6 +31,7 @@
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/multi_plan_rate_limiter.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_collection_stage.h"
@ -68,7 +69,7 @@ extern FailPoint sleepWhileMultiplanning;
*/
class MultiPlanStage final : public RequiresCollectionStage {
public:
static const char* kStageType;
static constexpr StringData kStageType = "MULTI_PLAN"_sd;
struct EstimationResult {
// The total cost of all plans (sum of plan costs).

View File

@ -43,7 +43,7 @@
namespace mongo {
NearStage::NearStage(ExpressionContext* expCtx,
const char* typeName,
StringData typeName,
StageType type,
WorkingSet* workingSet,
CollectionAcquisition collection,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/recordid_deduplicator.h"
#include "mongo/db/exec/classic/requires_index_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -103,7 +104,7 @@ protected:
* Subclasses of NearStage must provide basics + a stats object which gets owned here.
*/
NearStage(ExpressionContext* expCtx,
const char* typeName,
StringData typeName,
StageType type,
WorkingSet* workingSet,
CollectionAcquisition collection,

View File

@ -44,8 +44,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* OrStage::kStageType = "OR";
OrStage::OrStage(ExpressionContext* expCtx,
WorkingSet* ws,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/recordid_deduplicator.h"
#include "mongo/db/exec/classic/working_set.h"
@ -72,7 +73,7 @@ public:
return _memoryTracker;
}
static const char* kStageType;
static constexpr StringData kStageType = "OR"_sd;
private:
// Not owned by us.

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stage_timer.h"
#include "mongo/db/exec/plan_stats.h"
@ -124,7 +125,7 @@ class RecordId;
*/
class PlanStage {
public:
PlanStage(const char* typeName, ExpressionContext* expCtx)
PlanStage(StringData typeName, ExpressionContext* expCtx)
: _commonStats(typeName, this), _opCtx(expCtx->getOperationContext()), _expCtx(expCtx) {
invariant(expCtx);
if (expCtx->getExplain() || expCtx->getMayDbProfile()) {
@ -137,7 +138,7 @@ protected:
* Obtain a PlanStage given a child stage. Called during the construction of derived
* PlanStage types with a single direct descendant.
*/
PlanStage(ExpressionContext* expCtx, std::unique_ptr<PlanStage> child, const char* typeName)
PlanStage(ExpressionContext* expCtx, std::unique_ptr<PlanStage> child, StringData typeName)
: PlanStage(typeName, expCtx) {
_children.push_back(std::move(child));
}

View File

@ -132,7 +132,7 @@ ProjectionStage::ProjectionStage(ExpressionContext* expCtx,
const BSONObj& projObj,
WorkingSet* ws,
std::unique_ptr<PlanStage> child,
const char* stageType)
StringData stageType)
: PlanStage{expCtx, std::move(child), stageType},
_projObj{expCtx->getExplain() ? boost::make_optional(projObj.getOwned()) : boost::none},
_ws{*ws} {}

View File

@ -59,7 +59,7 @@ protected:
const BSONObj& projObj,
WorkingSet* ws,
std::unique_ptr<PlanStage> child,
const char* stageType);
StringData stageType);
public:
bool isEOF() const final;

View File

@ -35,7 +35,6 @@ namespace mongo {
using std::unique_ptr;
const char* QueuedDataStage::kStageType = "QUEUED_DATA";
QueuedDataStage::QueuedDataStage(ExpressionContext* expCtx, WorkingSet*)
: PlanStage(kStageType, expCtx) {}

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -84,7 +85,7 @@ public:
*/
void pushBack(const WorkingSetID& id);
static const char* kStageType;
static constexpr StringData kStageType = "QUEUED_DATA"_sd;
private:
// The data we return.

View File

@ -35,7 +35,6 @@
namespace mongo {
const char* RecordStoreFastCountStage::kStageType = "RECORD_STORE_FAST_COUNT";
RecordStoreFastCountStage::RecordStoreFastCountStage(ExpressionContext* expCtx,
CollectionAcquisition collection,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_collection_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -49,7 +50,7 @@ namespace mongo {
*/
class RecordStoreFastCountStage final : public RequiresCollectionStage {
public:
static const char* kStageType;
static constexpr StringData kStageType = "RECORD_STORE_FAST_COUNT"_sd;
RecordStoreFastCountStage(ExpressionContext* expCtx,
CollectionAcquisition collection,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/requires_collection_stage.h"
#include "mongo/db/query/all_indices_required_checker.h"
#include "mongo/db/query/multiple_collection_accessor.h"
@ -43,7 +44,7 @@ namespace mongo {
*/
class RequiresAllIndicesStage : public RequiresCollectionStage {
public:
RequiresAllIndicesStage(const char* stageType,
RequiresAllIndicesStage(StringData stageType,
ExpressionContext* expCtx,
CollectionAcquisition coll)
: RequiresCollectionStage(stageType, expCtx, coll) {

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/pipeline/expression_context.h"
@ -56,7 +57,7 @@ namespace mongo {
*/
class RequiresCollectionStage : public PlanStage {
public:
RequiresCollectionStage(const char* stageType,
RequiresCollectionStage(StringData stageType,
ExpressionContext* expCtx,
CollectionAcquisition coll)
: PlanStage(stageType, expCtx),
@ -120,7 +121,7 @@ private:
// Type alias for use by PlanStages that write to a Collection.
class RequiresWritableCollectionStage : public RequiresCollectionStage {
public:
RequiresWritableCollectionStage(const char* stageType,
RequiresWritableCollectionStage(StringData stageType,
ExpressionContext* expCtx,
CollectionAcquisition coll)
: RequiresCollectionStage(stageType, expCtx, coll), _collectionAcquisition(coll) {}

View File

@ -37,7 +37,7 @@
namespace mongo {
RequiresIndexStage::RequiresIndexStage(const char* stageType,
RequiresIndexStage::RequiresIndexStage(StringData stageType,
ExpressionContext* expCtx,
CollectionAcquisition collection,
const IndexCatalogEntry* indexEntry,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/requires_collection_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/index/index_access_method.h"
@ -54,7 +55,7 @@ namespace mongo {
*/
class RequiresIndexStage : public RequiresCollectionStage {
public:
RequiresIndexStage(const char* stageType,
RequiresIndexStage(StringData stageType,
ExpressionContext* expCtx,
CollectionAcquisition collection,
const IndexCatalogEntry* indexEntry,

View File

@ -53,7 +53,6 @@
namespace mongo {
const char* SampleFromTimeseriesBucket::kStageType = "SAMPLE_FROM_TIMESERIES_BUCKET";
SampleFromTimeseriesBucket::SampleFromTimeseriesBucket(
ExpressionContext* expCtx,

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/data_view.h"
#include "mongo/base/string_data.h"
#include "mongo/bson/oid.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -58,7 +59,7 @@ namespace mongo {
*/
class SampleFromTimeseriesBucket final : public PlanStage {
public:
static const char* kStageType;
static constexpr StringData kStageType = "SAMPLE_FROM_TIMESERIES_BUCKET"_sd;
/**
* Constructs a 'SampleFromTimeseriesBucket' stage which uses 'bucketUnpacker' to materialize

View File

@ -47,8 +47,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* ShardFilterStage::kStageType = "SHARDING_FILTER";
ShardFilterStage::ShardFilterStage(ExpressionContext* expCtx,
ScopedCollectionFilter collectionFilter,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -74,7 +75,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "SHARDING_FILTER"_sd;
private:
WorkingSet* _ws;

View File

@ -37,8 +37,6 @@ namespace mongo {
using std::unique_ptr;
// static
const char* SkipStage::kStageType = "SKIP";
SkipStage::SkipStage(ExpressionContext* expCtx,
long long toSkip,

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -66,7 +67,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "SKIP"_sd;
private:
WorkingSet* _ws;

View File

@ -47,7 +47,7 @@ SortStage::SortStage(boost::intrusive_ptr<ExpressionContext> expCtx,
SortPattern sortPattern,
bool addSortKeyMetadata,
std::unique_ptr<PlanStage> child)
: PlanStage(kStageType.data(), expCtx.get()),
: PlanStage(kStageType, expCtx.get()),
_ws(ws),
_sortKeyGen(sortPattern, expCtx->getCollator()),
_addSortKeyMetadata(addSortKeyMetadata),

View File

@ -44,7 +44,6 @@
namespace mongo {
const char* SortKeyGeneratorStage::kStageType = "SORT_KEY_GENERATOR";
SortKeyGeneratorStage::SortKeyGeneratorStage(const boost::intrusive_ptr<ExpressionContext>& expCtx,
std::unique_ptr<PlanStage> child,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -70,7 +71,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "SORT_KEY_GENERATOR"_sd;
protected:
StageState doWork(WorkingSetID* out) final;

View File

@ -64,7 +64,6 @@ mongo::PlanStage::StageState allocateResultAndAdvance(mongo::WorkingSet* ws,
namespace mongo {
const char* SpoolStage::kStageType = "SPOOL";
SpoolStage::SpoolStage(ExpressionContext* expCtx, WorkingSet* ws, std::unique_ptr<PlanStage> child)
: PlanStage(expCtx, std::move(child), kStageType),

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -59,7 +60,7 @@ namespace mongo {
*/
class SpoolStage final : public PlanStage {
public:
static const char* kStageType;
static constexpr StringData kStageType = "SPOOL"_sd;
SpoolStage(ExpressionContext* expCtx, WorkingSet* ws, std::unique_ptr<PlanStage> child);

View File

@ -59,7 +59,6 @@ namespace mongo {
using std::unique_ptr;
using std::vector;
const char* SubplanStage::kStageType = "SUBPLAN";
SubplanStage::SubplanStage(ExpressionContext* expCtx,
CollectionAcquisition collection,

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/multi_plan.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_all_indices_stage.h"
@ -115,7 +116,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "SUBPLAN"_sd;
/**
* Selects a plan using subplanning. First uses the query planning results from

View File

@ -42,7 +42,6 @@ namespace mongo {
using std::unique_ptr;
const char* TextMatchStage::kStageType = "TEXT_MATCH";
TextMatchStage::TextMatchStage(ExpressionContext* expCtx,
unique_ptr<PlanStage> child,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -103,7 +104,7 @@ public:
const SpecificStats* getSpecificStats() const final;
static const char* kStageType;
static constexpr StringData kStageType = "TEXT_MATCH"_sd;
private:
// Text-specific phrase and negated term matcher.

View File

@ -66,7 +66,6 @@ int64_t getMemoryLimit() {
} // namespace
const char* TextOrStage::kStageType = "TEXT_OR";
TextOrStage::TextOrStage(ExpressionContext* expCtx,
size_t keyPrefixSize,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/requires_collection_stage.h"
#include "mongo/db/exec/classic/working_set.h"
@ -106,7 +107,7 @@ public:
return _memoryTracker;
}
static const char* kStageType;
static constexpr StringData kStageType = "TEXT_OR"_sd;
class Comparator {
public:

View File

@ -77,7 +77,6 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kWrite
namespace mongo {
const char* TimeseriesModifyStage::kStageType = "TS_MODIFY";
TimeseriesModifyStage::TimeseriesModifyStage(ExpressionContext* expCtx,
TimeseriesModifyParams&& params,

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/basic_types.h"
#include "mongo/db/exec/classic/delete_stage.h"
@ -138,7 +139,7 @@ struct TimeseriesModifyParams {
*/
class TimeseriesModifyStage : public RequiresWritableCollectionStage {
public:
static const char* kStageType;
static constexpr StringData kStageType = "TS_MODIFY"_sd;
TimeseriesModifyStage(ExpressionContext* expCtx,
TimeseriesModifyParams&& params,

View File

@ -40,7 +40,6 @@
namespace mongo {
const char* TrialStage::kStageType = "TRIAL";
TrialStage::TrialStage(ExpressionContext* expCtx,
WorkingSet* ws,

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -61,7 +62,7 @@ namespace mongo {
*/
class TrialStage final : public PlanStage {
public:
static const char* kStageType;
static constexpr StringData kStageType = "TRIAL"_sd;
/**
* Constructor. Both 'trialPlan' and 'backupPlan' must be non-nullptr; 'maxTrialEWorks' must be

View File

@ -48,7 +48,6 @@ void transitionToOwnedObj(Document&& doc, WorkingSetMember* member) {
}
} // namespace
const char* UnpackTimeseriesBucket::kStageType = "UNPACK_BUCKET";
UnpackTimeseriesBucket::UnpackTimeseriesBucket(ExpressionContext* expCtx,
WorkingSet* ws,

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/classic/plan_stage.h"
#include "mongo/db/exec/classic/working_set.h"
#include "mongo/db/exec/plan_stats.h"
@ -47,7 +48,7 @@ namespace mongo {
*/
class UnpackTimeseriesBucket final : public PlanStage {
public:
static const char* kStageType;
static constexpr StringData kStageType = "UNPACK_BUCKET"_sd;
UnpackTimeseriesBucket(ExpressionContext* expCtx,
WorkingSet* ws,

View File

@ -115,7 +115,7 @@ UpdateStage::UpdateStage(ExpressionContext* expCtx,
const UpdateStageParams& params,
WorkingSet* ws,
CollectionAcquisition collection)
: RequiresWritableCollectionStage(kStageType.data(), expCtx, collection),
: RequiresWritableCollectionStage(kStageType, expCtx, collection),
_params(params),
_ws(ws),
_doc(params.driver->getDocument()),

View File

@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/db/exec/container_size_helper.h"
#include "mongo/db/exec/plan_stats_visitor.h"
#include "mongo/db/index/multikey_paths.h"
@ -86,9 +87,9 @@ struct MONGO_MOD_NEEDS_REPLACEMENT SpecificStats {
struct CommonStats {
CommonStats() = delete;
CommonStats(const char* type) : CommonStats(type, nullptr /*originalPlanStage*/) {}
CommonStats(StringData type) : CommonStats(type, nullptr /*originalPlanStage*/) {}
CommonStats(const char* type, PlanStageKey originalPlanStage)
CommonStats(StringData type, PlanStageKey originalPlanStage)
: stageTypeStr(type),
planStage(originalPlanStage),
works(0),
@ -104,7 +105,7 @@ struct CommonStats {
return filter.objsize() + sizeof(*this);
}
// String giving the type of the stage. Not owned.
const char* stageTypeStr;
StringData stageTypeStr;
// Store an identifier to the plan stage which this object is describing.
PlanStageKey planStage;

View File

@ -31,6 +31,7 @@
* This file contains tests for mongo/db/query/plan_ranker.h
*/
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonelement.h"
#include "mongo/bson/bsonmisc.h"
#include "mongo/db/exec/plan_stats.h"
@ -61,7 +62,7 @@ unique_ptr<CanonicalQuery> makeCanonicalQuery() {
.expCtx = expCtx, .parsedFind = ParsedFindCommandParams{std::move(findCommand)}});
}
unique_ptr<PlanStageStats> makeStats(const char* name,
unique_ptr<PlanStageStats> makeStats(StringData name,
StageType type,
unique_ptr<SpecificStats> specific,
size_t works = 1,