summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/find_cmd.cpp
diff options
context:
space:
mode:
authorSvilen Mihaylov <svilen.mihaylov@mongodb.com>2022-01-31 21:05:27 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-31 21:48:46 +0000
commit50db8e9573e191ba2c193b4ef3dba6b5c6488f82 (patch)
tree1d211e40920b5952af569bb6e9fa7dd830d5bbaa /src/mongo/db/commands/find_cmd.cpp
parentb696e034fe97e7699dd45ac2595422e1d510ba2c (diff)
downloadmongo-50db8e9573e191ba2c193b4ef3dba6b5c6488f82.tar.gz
SERVER-62434 Implement query optimizer based on Path algebra and Cascades
Diffstat (limited to 'src/mongo/db/commands/find_cmd.cpp')
-rw-r--r--src/mongo/db/commands/find_cmd.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index aaf86a480ef..d1fbe6fa8c7 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -51,6 +51,7 @@
#include "mongo/db/query/find.h"
#include "mongo/db/query/find_common.h"
#include "mongo/db/query/get_executor.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/counters.h"
@@ -317,7 +318,12 @@ public:
extensionsCallback,
MatchExpressionParser::kAllowAllSpecialFeatures));
- if (ctx->getView()) {
+ // If we are running a query against a view, or if we are trying to test the new
+ // optimizer, redirect this query through the aggregation system.
+ if (ctx->getView() ||
+ (feature_flags::gfeatureFlagCommonQueryFramework.isEnabled(
+ serverGlobalParams.featureCompatibility) &&
+ internalQueryEnableCascadesOptimizer.load())) {
// Relinquish locks. The aggregation command will re-acquire them.
ctx.reset();
@@ -521,7 +527,12 @@ public:
extensionsCallback,
MatchExpressionParser::kAllowAllSpecialFeatures));
- if (ctx->getView()) {
+ // If we are running a query against a view, or if we are trying to test the new
+ // optimizer, redirect this query through the aggregation system.
+ if (ctx->getView() ||
+ (feature_flags::gfeatureFlagCommonQueryFramework.isEnabled(
+ serverGlobalParams.featureCompatibility) &&
+ internalQueryEnableCascadesOptimizer.load())) {
// Relinquish locks. The aggregation command will re-acquire them.
ctx.reset();