diff options
author | Mathias Stearn <mathias@10gen.com> | 2013-08-30 16:34:58 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2013-09-20 15:46:19 -0400 |
commit | 0d9769e34c47dac2ec90386c46e69b6a48050232 (patch) | |
tree | bb87425070387e0165525b52695d7b5cf6df0f03 /src | |
parent | b7d4551298e2f55a46d42a9fff993c1e7e354883 (diff) | |
download | mongo-0d9769e34c47dac2ec90386c46e69b6a48050232.tar.gz |
Remove fake split-pipeline mode from aggregation
It was a bad idea and is only used by the disabled test for explain.
When complete, the explain test will use an actual sharded cluster
rather than a fake one.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands/pipeline_command.cpp | 83 | ||||
-rw-r--r-- | src/mongo/db/pipeline/pipeline.cpp | 13 | ||||
-rw-r--r-- | src/mongo/db/pipeline/pipeline.h | 22 |
3 files changed, 0 insertions, 118 deletions
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 99611286426..7b385aaf696 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -233,11 +233,6 @@ namespace mongo { if (!pPipeline.get()) return false; - if (pPipeline->getSplitMongodPipeline()) { - // This is only used in testing - return executeSplitPipeline(result, errmsg, ns, db, pPipeline, pCtx); - } - #if _DEBUG // This is outside of the if block to keep the object alive until the pipeline is finished. BSONObj parsed; @@ -276,84 +271,6 @@ namespace mongo { return true; } - - private: - /* - Execute the pipeline for the explain. This is common to both the - locked and unlocked code path. However, the results are different. - For an explain, with no lock, it really outputs the pipeline - chain rather than fetching the data. - */ - bool executeSplitPipeline(BSONObjBuilder& result, string& errmsg, - const string& ns, const string& db, - intrusive_ptr<Pipeline>& pPipeline, - intrusive_ptr<ExpressionContext>& pCtx) { - /* setup as if we're in the router */ - pCtx->inRouter = true; - - /* - Here, we'll split the pipeline in the same way we would for sharding, - for testing purposes. - - Run the shard pipeline first, then feed the results into the remains - of the existing pipeline. - - Start by splitting the pipeline. - */ - intrusive_ptr<Pipeline> pShardSplit = pPipeline->splitForSharded(); - - // Write the split pipeline as we would in order to transmit it to the shard servers. - Document shardCmd = pShardSplit->serialize(); - - DEV log() << "\n---- shardDescription\n" << shardCmd.toString() << "\n----\n"; - - // for debugging purposes, show what the pipeline now looks like - DEV log() << "\n---- pipelineDescription\n" << pPipeline->serialize() << "\n----\n"; - - /* on the shard servers, create the local pipeline */ - intrusive_ptr<ExpressionContext> pShardCtx = - new ExpressionContext(InterruptStatusMongod::status, NamespaceString(ns)); - BSONObj shardObj = shardCmd.toBson(); - intrusive_ptr<Pipeline> pShardPipeline( - Pipeline::parseCommand(errmsg, shardObj, pShardCtx)); - if (!pShardPipeline.get()) { - return false; - } - - PipelineD::prepareCursorSource(pShardPipeline, nsToDatabase(ns), pCtx); - - /* run the shard pipeline */ - BSONObjBuilder shardResultBuilder; - string shardErrmsg; - pShardPipeline->stitch(); - pShardPipeline->run(shardResultBuilder); - BSONObj shardResult(shardResultBuilder.done()); - - /* pick out the shard result, and prepare to read it */ - intrusive_ptr<DocumentSourceBsonArray> pShardSource; - BSONObjIterator shardIter(shardResult); - while(shardIter.more()) { - BSONElement shardElement(shardIter.next()); - const char *pFieldName = shardElement.fieldName(); - - if ((strcmp(pFieldName, "result") == 0) || - (strcmp(pFieldName, "serverPipeline") == 0)) { - pPipeline->addInitialSource(DocumentSourceBsonArray::create(&shardElement, pCtx)); - pPipeline->stitch(); - - /* - Connect the output of the shard pipeline with the mongos - pipeline that will merge the results. - */ - pPipeline->run(result); - return true; - } - } - - /* NOTREACHED */ - verify(false); - return false; - } } cmdPipeline; } // namespace mongo diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp index d80fa64bd8c..7244c9d3bcf 100644 --- a/src/mongo/db/pipeline/pipeline.cpp +++ b/src/mongo/db/pipeline/pipeline.cpp @@ -46,14 +46,12 @@ namespace mongo { const char Pipeline::pipelineName[] = "pipeline"; const char Pipeline::explainName[] = "explain"; const char Pipeline::fromRouterName[] = "fromRouter"; - const char Pipeline::splitMongodPipelineName[] = "splitMongodPipeline"; const char Pipeline::serverPipelineName[] = "serverPipeline"; const char Pipeline::mongosPipelineName[] = "mongosPipeline"; Pipeline::Pipeline(const intrusive_ptr<ExpressionContext> &pTheCtx): collectionName(), explain(false), - splitMongodPipeline(false), pCtx(pTheCtx) { } @@ -143,12 +141,6 @@ namespace mongo { continue; } - /* check for debug options */ - if (!strcmp(pFieldName, splitMongodPipelineName)) { - pPipeline->splitMongodPipeline = true; - continue; - } - if (str::equals(pFieldName, "allowDiskUsage")) { uassert(16949, str::stream() << "allowDiskUsage must be a bool, not a " @@ -437,11 +429,6 @@ namespace mongo { serialized.setField("allowDiskUsage", Value(true)); } - bool btemp; - if ((btemp = getSplitMongodPipeline())) { - serialized.setField(splitMongodPipelineName, Value(btemp)); - } - return serialized.freeze(); } diff --git a/src/mongo/db/pipeline/pipeline.h b/src/mongo/db/pipeline/pipeline.h index 4e5caa847ee..c00a4598b97 100644 --- a/src/mongo/db/pipeline/pipeline.h +++ b/src/mongo/db/pipeline/pipeline.h @@ -126,19 +126,6 @@ namespace mongo { void run(BSONObjBuilder& result); /** - Debugging: should the processing pipeline be split within - mongod, simulating the real mongos/mongod split? This is determined - by setting the splitMongodPipeline field in an "aggregate" - command. - - The split itself is handled by the caller, which is currently - pipeline_command.cpp. - - @returns true if the pipeline is to be split - */ - bool getSplitMongodPipeline() const; - - /** Ask if this is for an explain request. @returns true if this is an explain @@ -174,7 +161,6 @@ namespace mongo { static const char pipelineName[]; static const char explainName[]; static const char fromRouterName[]; - static const char splitMongodPipelineName[]; static const char serverPipelineName[]; static const char mongosPipelineName[]; @@ -218,7 +204,6 @@ namespace mongo { SourceContainer sources; bool explain; - bool splitMongodPipeline; boost::intrusive_ptr<ExpressionContext> pCtx; }; @@ -233,13 +218,6 @@ namespace mongo { return collectionName; } - inline bool Pipeline::getSplitMongodPipeline() const { - if (!DEBUG_BUILD) - return false; - - return splitMongodPipeline; - } - inline bool Pipeline::isExplain() const { return explain; } |