summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorKevinCybura <KevinCybura@gmail.com>2018-05-01 13:35:19 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2018-05-11 18:24:26 -0400
commite885cbbc9458eb0de8882ba4fe0b5591498efaf1 (patch)
tree765b3f0a5d41b784877ded6a5f39d73bd55b8512 /src/mongo
parentf2853bb09946ce5bb7779ff6ad8139a23cf35a90 (diff)
downloadmongo-e885cbbc9458eb0de8882ba4fe0b5591498efaf1.tar.gz
SERVER-25596 Rename SplittableDocumentSource to NeedsMergerDocumentSource
Closes #1237 Signed-off-by: Charlie Swanson <charlie.swanson@mongodb.com>
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/pipeline/cluster_aggregation_planner.cpp6
-rw-r--r--src/mongo/db/pipeline/document_source.h15
-rw-r--r--src/mongo/db/pipeline/document_source_bucket_auto.h2
-rw-r--r--src/mongo/db/pipeline/document_source_change_stream.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_check_resume_token.h8
-rw-r--r--src/mongo/db/pipeline/document_source_facet.h2
-rw-r--r--src/mongo/db/pipeline/document_source_geo_near.h4
-rw-r--r--src/mongo/db/pipeline/document_source_group.h4
-rw-r--r--src/mongo/db/pipeline/document_source_group_test.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_internal_split_pipeline.h2
-rw-r--r--src/mongo/db/pipeline/document_source_limit.h2
-rw-r--r--src/mongo/db/pipeline/document_source_lookup.h2
-rw-r--r--src/mongo/db/pipeline/document_source_out.h4
-rw-r--r--src/mongo/db/pipeline/document_source_sample.h2
-rw-r--r--src/mongo/db/pipeline/document_source_skip.h4
-rw-r--r--src/mongo/db/pipeline/document_source_sort.h2
-rw-r--r--src/mongo/db/pipeline/pipeline.cpp2
17 files changed, 32 insertions, 33 deletions
diff --git a/src/mongo/db/pipeline/cluster_aggregation_planner.cpp b/src/mongo/db/pipeline/cluster_aggregation_planner.cpp
index 3653b5b2638..53ea48dd68f 100644
--- a/src/mongo/db/pipeline/cluster_aggregation_planner.cpp
+++ b/src/mongo/db/pipeline/cluster_aggregation_planner.cpp
@@ -46,15 +46,15 @@ namespace {
*
* It is not safe to call this optimization multiple times.
*
- * NOTE: looks for SplittableDocumentSources and uses that API
+ * NOTE: looks for NeedsMergerDocumentSources and uses that API
*/
void findSplitPoint(Pipeline* shardPipe, Pipeline* mergePipe) {
while (!mergePipe->getSources().empty()) {
boost::intrusive_ptr<DocumentSource> current = mergePipe->popFront();
// Check if this source is splittable.
- SplittableDocumentSource* splittable =
- dynamic_cast<SplittableDocumentSource*>(current.get());
+ NeedsMergerDocumentSource* splittable =
+ dynamic_cast<NeedsMergerDocumentSource*>(current.get());
if (!splittable) {
// Move the source from the merger _sources to the shard _sources.
diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h
index 3b4b421f358..b6e52d447fb 100644
--- a/src/mongo/db/pipeline/document_source.h
+++ b/src/mongo/db/pipeline/document_source.h
@@ -706,7 +706,7 @@ private:
* This class marks DocumentSources that should be split between the merger and the shards. See
* Pipeline::Optimizations::Sharded::findSplitPoint() for details.
*/
-class SplittableDocumentSource {
+class NeedsMergerDocumentSource {
public:
/**
* Returns a source to be run on the shards, or NULL if no work should be done on the shards for
@@ -719,17 +719,16 @@ public:
virtual boost::intrusive_ptr<DocumentSource> getShardSource() = 0;
/**
- * Returns a list of stages that combine results from the shards, or an empty list if no work
- * should be done in the merge pipeline for this stage. Must not mutate the existing source
- * object; if different behaviour is required, a new source should be created and configured
- * appropriately. It is an error for getMergeSources() to return a pointer to the same object as
- * getShardSource().
+ * Returns a list of stages that combine results from the shards. Subclasses of this class
+ * should not return an empty list. Must not mutate the existing source object; if different
+ * behaviour is required, a new source should be created and configured appropriately. It is an
+ * error for getMergeSources() to return a pointer to the same object as getShardSource().
*/
virtual std::list<boost::intrusive_ptr<DocumentSource>> getMergeSources() = 0;
protected:
- // It is invalid to delete through a SplittableDocumentSource-typed pointer.
- virtual ~SplittableDocumentSource() {}
+ // It is invalid to delete through a NeedsMergerDocumentSource-typed pointer.
+ virtual ~NeedsMergerDocumentSource() {}
};
} // namespace mongo
diff --git a/src/mongo/db/pipeline/document_source_bucket_auto.h b/src/mongo/db/pipeline/document_source_bucket_auto.h
index a5b041d741e..b2f46e2e7ae 100644
--- a/src/mongo/db/pipeline/document_source_bucket_auto.h
+++ b/src/mongo/db/pipeline/document_source_bucket_auto.h
@@ -41,7 +41,7 @@ namespace mongo {
* The $bucketAuto stage takes a user-specified number of buckets and automatically determines
* boundaries such that the values are approximately equally distributed between those buckets.
*/
-class DocumentSourceBucketAuto final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceBucketAuto final : public DocumentSource, public NeedsMergerDocumentSource {
public:
Value serialize(boost::optional<ExplainOptions::Verbosity> explain = boost::none) const final;
GetDepsReturn getDependencies(DepsTracker* deps) const final;
diff --git a/src/mongo/db/pipeline/document_source_change_stream.cpp b/src/mongo/db/pipeline/document_source_change_stream.cpp
index 7992ab9ec3b..602fd1edd46 100644
--- a/src/mongo/db/pipeline/document_source_change_stream.cpp
+++ b/src/mongo/db/pipeline/document_source_change_stream.cpp
@@ -142,7 +142,7 @@ namespace {
* "invalidate" entries.
* It is not intended to be created by the user.
*/
-class DocumentSourceCloseCursor final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceCloseCursor final : public DocumentSource, public NeedsMergerDocumentSource {
public:
GetNextResult getNext() final;
diff --git a/src/mongo/db/pipeline/document_source_check_resume_token.h b/src/mongo/db/pipeline/document_source_check_resume_token.h
index 1c04472eb62..430f3c3a6ce 100644
--- a/src/mongo/db/pipeline/document_source_check_resume_token.h
+++ b/src/mongo/db/pipeline/document_source_check_resume_token.h
@@ -91,7 +91,7 @@ private:
* stream. It is not intended to be created by the user.
*/
class DocumentSourceEnsureResumeTokenPresent final : public DocumentSource,
- public SplittableDocumentSource {
+ public NeedsMergerDocumentSource {
public:
// Used to record the results of comparing the token data extracted from documents in the
// resumed stream against the client's resume token.
@@ -118,9 +118,9 @@ public:
}
/**
- * SplittableDocumentSource methods; this has to run on the merger, since the resume point could
- * be at any shard. Also add a DocumentSourceShardCheckResumability stage on the shards pipeline
- * to ensure that each shard has enough oplog history to resume the change stream.
+ * NeedsMergerDocumentSource methods; this has to run on the merger, since the resume point
+ * could be at any shard. Also add a DocumentSourceShardCheckResumability stage on the shards
+ * pipeline to ensure that each shard has enough oplog history to resume the change stream.
*/
boost::intrusive_ptr<DocumentSource> getShardSource() final {
return DocumentSourceShardCheckResumability::create(pExpCtx,
diff --git a/src/mongo/db/pipeline/document_source_facet.h b/src/mongo/db/pipeline/document_source_facet.h
index 32248772188..cfb0580090d 100644
--- a/src/mongo/db/pipeline/document_source_facet.h
+++ b/src/mongo/db/pipeline/document_source_facet.h
@@ -55,7 +55,7 @@ class NamespaceString;
* stage which will produce a document like the following:
* {facetA: [<all input documents except the first one>], facetB: [<the first document>]}.
*/
-class DocumentSourceFacet final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceFacet final : public DocumentSource, public NeedsMergerDocumentSource {
public:
struct FacetPipeline {
FacetPipeline(std::string name, std::unique_ptr<Pipeline, PipelineDeleter> pipeline)
diff --git a/src/mongo/db/pipeline/document_source_geo_near.h b/src/mongo/db/pipeline/document_source_geo_near.h
index d390967af81..fa67ab1c71a 100644
--- a/src/mongo/db/pipeline/document_source_geo_near.h
+++ b/src/mongo/db/pipeline/document_source_geo_near.h
@@ -33,7 +33,7 @@
namespace mongo {
-class DocumentSourceGeoNear : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceGeoNear : public DocumentSource, public NeedsMergerDocumentSource {
public:
static const long long kDefaultLimit;
@@ -67,7 +67,7 @@ public:
{BSON(distanceField->fullPath() << -1)});
}
- // Virtuals for SplittableDocumentSource
+ // Virtuals for NeedsMergerDocumentSource
boost::intrusive_ptr<DocumentSource> getShardSource() final;
std::list<boost::intrusive_ptr<DocumentSource>> getMergeSources() final;
diff --git a/src/mongo/db/pipeline/document_source_group.h b/src/mongo/db/pipeline/document_source_group.h
index af262fd739e..eeec779807f 100644
--- a/src/mongo/db/pipeline/document_source_group.h
+++ b/src/mongo/db/pipeline/document_source_group.h
@@ -38,7 +38,7 @@
namespace mongo {
-class DocumentSourceGroup final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceGroup final : public DocumentSource, public NeedsMergerDocumentSource {
public:
using Accumulators = std::vector<boost::intrusive_ptr<Accumulator>>;
using GroupsMap = ValueUnorderedMap<Accumulators>;
@@ -99,7 +99,7 @@ public:
return _streaming;
}
- // Virtuals for SplittableDocumentSource.
+ // Virtuals for NeedsMergerDocumentSource.
boost::intrusive_ptr<DocumentSource> getShardSource() final;
std::list<boost::intrusive_ptr<DocumentSource>> getMergeSources() final;
diff --git a/src/mongo/db/pipeline/document_source_group_test.cpp b/src/mongo/db/pipeline/document_source_group_test.cpp
index 3f0bc9b6671..de99452f3d7 100644
--- a/src/mongo/db/pipeline/document_source_group_test.cpp
+++ b/src/mongo/db/pipeline/document_source_group_test.cpp
@@ -542,7 +542,7 @@ protected:
intrusive_ptr<DocumentSource> createMerger() {
// Set up a group merger to simulate merging results in the router. In this
// case only one shard is in use.
- SplittableDocumentSource* splittable = dynamic_cast<SplittableDocumentSource*>(group());
+ NeedsMergerDocumentSource* splittable = dynamic_cast<NeedsMergerDocumentSource*>(group());
ASSERT(splittable);
auto routerSources = splittable->getMergeSources();
ASSERT_EQ(routerSources.size(), 1UL);
diff --git a/src/mongo/db/pipeline/document_source_internal_split_pipeline.h b/src/mongo/db/pipeline/document_source_internal_split_pipeline.h
index bf93c58c100..2d5bf946ead 100644
--- a/src/mongo/db/pipeline/document_source_internal_split_pipeline.h
+++ b/src/mongo/db/pipeline/document_source_internal_split_pipeline.h
@@ -42,7 +42,7 @@ namespace mongo {
* random participating shard otherwise.
*/
class DocumentSourceInternalSplitPipeline final : public DocumentSource,
- public SplittableDocumentSource {
+ public NeedsMergerDocumentSource {
public:
static constexpr StringData kStageName = "$_internalSplitPipeline"_sd;
diff --git a/src/mongo/db/pipeline/document_source_limit.h b/src/mongo/db/pipeline/document_source_limit.h
index 3c8c21c2511..cfdbbdec036 100644
--- a/src/mongo/db/pipeline/document_source_limit.h
+++ b/src/mongo/db/pipeline/document_source_limit.h
@@ -32,7 +32,7 @@
namespace mongo {
-class DocumentSourceLimit final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceLimit final : public DocumentSource, public NeedsMergerDocumentSource {
public:
static constexpr StringData kStageName = "$limit"_sd;
diff --git a/src/mongo/db/pipeline/document_source_lookup.h b/src/mongo/db/pipeline/document_source_lookup.h
index c9f8872f580..db62fb9b9f4 100644
--- a/src/mongo/db/pipeline/document_source_lookup.h
+++ b/src/mongo/db/pipeline/document_source_lookup.h
@@ -45,7 +45,7 @@ namespace mongo {
* Queries separate collection for equality matches with documents in the pipeline collection.
* Adds matching documents to a new array field in the input document.
*/
-class DocumentSourceLookUp final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceLookUp final : public DocumentSource, public NeedsMergerDocumentSource {
public:
static constexpr size_t kMaxSubPipelineDepth = 20;
diff --git a/src/mongo/db/pipeline/document_source_out.h b/src/mongo/db/pipeline/document_source_out.h
index ad6659f42b0..d6732e59b9d 100644
--- a/src/mongo/db/pipeline/document_source_out.h
+++ b/src/mongo/db/pipeline/document_source_out.h
@@ -32,7 +32,7 @@
namespace mongo {
-class DocumentSourceOut final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceOut final : public DocumentSource, public NeedsMergerDocumentSource {
public:
static std::unique_ptr<LiteParsedDocumentSourceForeignCollections> liteParse(
const AggregationRequest& request, const BSONElement& spec);
@@ -53,7 +53,7 @@ public:
TransactionRequirement::kNotAllowed};
}
- // Virtuals for SplittableDocumentSource
+ // Virtuals for NeedsMergerDocumentSource
boost::intrusive_ptr<DocumentSource> getShardSource() final {
return NULL;
}
diff --git a/src/mongo/db/pipeline/document_source_sample.h b/src/mongo/db/pipeline/document_source_sample.h
index 1ac496305ee..ddba846442d 100644
--- a/src/mongo/db/pipeline/document_source_sample.h
+++ b/src/mongo/db/pipeline/document_source_sample.h
@@ -33,7 +33,7 @@
namespace mongo {
-class DocumentSourceSample final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceSample final : public DocumentSource, public NeedsMergerDocumentSource {
public:
static constexpr StringData kStageName = "$sample"_sd;
diff --git a/src/mongo/db/pipeline/document_source_skip.h b/src/mongo/db/pipeline/document_source_skip.h
index 760e887f8b4..bb14fd3966e 100644
--- a/src/mongo/db/pipeline/document_source_skip.h
+++ b/src/mongo/db/pipeline/document_source_skip.h
@@ -32,7 +32,7 @@
namespace mongo {
-class DocumentSourceSkip final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceSkip final : public DocumentSource, public NeedsMergerDocumentSource {
public:
static constexpr StringData kStageName = "$skip"_sd;
@@ -82,7 +82,7 @@ public:
return SEE_NEXT; // This doesn't affect needed fields
}
- // Virtuals for SplittableDocumentSource
+ // Virtuals for NeedsMergerDocumentSource
// Need to run on rounter. Can't run on shards.
boost::intrusive_ptr<DocumentSource> getShardSource() final {
return NULL;
diff --git a/src/mongo/db/pipeline/document_source_sort.h b/src/mongo/db/pipeline/document_source_sort.h
index d5846774be8..81871e7224c 100644
--- a/src/mongo/db/pipeline/document_source_sort.h
+++ b/src/mongo/db/pipeline/document_source_sort.h
@@ -36,7 +36,7 @@
namespace mongo {
-class DocumentSourceSort final : public DocumentSource, public SplittableDocumentSource {
+class DocumentSourceSort final : public DocumentSource, public NeedsMergerDocumentSource {
public:
static const uint64_t kMaxMemoryUsageBytes = 100 * 1024 * 1024;
static constexpr StringData kStageName = "$sort"_sd;
diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp
index e63f15c147f..79dd962d871 100644
--- a/src/mongo/db/pipeline/pipeline.cpp
+++ b/src/mongo/db/pipeline/pipeline.cpp
@@ -384,7 +384,7 @@ bool Pipeline::requiredToRunOnMongos() const {
for (auto&& stage : _sources) {
// If this pipeline is capable of splitting before the mongoS-only stage, then the pipeline
// as a whole is not required to run on mongoS.
- if (isUnsplit() && dynamic_cast<SplittableDocumentSource*>(stage.get())) {
+ if (isUnsplit() && dynamic_cast<NeedsMergerDocumentSource*>(stage.get())) {
return false;
}