summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression.h
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/matcher/expression.h
parentf8dcc118e636778671a4550d4cf32d2908a0d7ad (diff)
downloadmongo-47a7e08012f57e471dff60d1933192786b54e50d.tar.gz
SERVER-35891 add failpoints to disable aggregation optimizations
Diffstat (limited to 'src/mongo/db/matcher/expression.h')
-rw-r--r--src/mongo/db/matcher/expression.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression.h b/src/mongo/db/matcher/expression.h
index bc86ec7852c..bc0796dc1a7 100644
--- a/src/mongo/db/matcher/expression.h
+++ b/src/mongo/db/matcher/expression.h
@@ -40,9 +40,16 @@
#include "mongo/db/pipeline/dependencies.h"
#include "mongo/stdx/functional.h"
#include "mongo/stdx/memory.h"
+#include "mongo/util/fail_point_service.h"
namespace mongo {
+/**
+ * Enabling the disableMatchExpressionOptimization fail point will stop match expressions from
+ * being optimized.
+ */
+MONGO_FAIL_POINT_DECLARE(disableMatchExpressionOptimization);
+
class CollatorInterface;
class MatchExpression;
class TreeMatchExpression;
@@ -135,6 +142,12 @@ public:
* The value of 'expression' must not be nullptr.
*/
static std::unique_ptr<MatchExpression> optimize(std::unique_ptr<MatchExpression> expression) {
+ // If the disableMatchExpressionOptimization failpoint is enabled, optimizations are skipped
+ // and the expression is left unmodified.
+ if (MONGO_FAIL_POINT(disableMatchExpressionOptimization)) {
+ return expression;
+ }
+
auto optimizer = expression->getOptimizer();
return optimizer(std::move(expression));
}