summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/pipeline.cpp
diff options
context:
space:
mode:
authorVarun Arora <varun.arora@10gen.com>2018-07-03 18:58:47 -0400
committerVarun Arora <varun.arora@10gen.com>2018-07-25 13:52:38 -0400
commit47a7e08012f57e471dff60d1933192786b54e50d (patch)
tree45c376ab58f9e024362cba5bb617f4cf01babf19 /src/mongo/db/pipeline/pipeline.cpp
parentf8dcc118e636778671a4550d4cf32d2908a0d7ad (diff)
downloadmongo-47a7e08012f57e471dff60d1933192786b54e50d.tar.gz
SERVER-35891 add failpoints to disable aggregation optimizations
Diffstat (limited to 'src/mongo/db/pipeline/pipeline.cpp')
-rw-r--r--src/mongo/db/pipeline/pipeline.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp
index 24f1d54a83d..ecf513b07b1 100644
--- a/src/mongo/db/pipeline/pipeline.cpp
+++ b/src/mongo/db/pipeline/pipeline.cpp
@@ -50,10 +50,18 @@
#include "mongo/db/pipeline/document_source_unwind.h"
#include "mongo/db/pipeline/expression.h"
#include "mongo/db/pipeline/expression_context.h"
+#include "mongo/util/fail_point_service.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
+/**
+ * Enabling the disablePipelineOptimization fail point will stop the aggregate command from
+ * attempting to optimize the pipeline or the pipeline stages. Neither DocumentSource::optimizeAt()
+ * nor DocumentSource::optimize() will be attempted.
+ */
+MONGO_FAIL_POINT_DEFINE(disablePipelineOptimization);
+
using boost::intrusive_ptr;
using std::endl;
using std::ostringstream;
@@ -241,6 +249,11 @@ void Pipeline::validateCommon() const {
}
void Pipeline::optimizePipeline() {
+ // If the disablePipelineOptimization failpoint is enabled, the pipeline won't be optimized.
+ if (MONGO_FAIL_POINT(disablePipelineOptimization)) {
+ return;
+ }
+
SourceContainer optimizedSources;
SourceContainer::iterator itr = _sources.begin();