summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/find_cmd.cpp
diff options
context:
space:
mode:
authorNicholas Zolnierz <nicholas.zolnierz@mongodb.com>2022-06-16 22:00:29 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-16 23:40:52 +0000
commit43cf2cd5f8ac1144e24323ef183ee21a024a9de9 (patch)
tree04fd3f7468a04302d8d1cf079d2c7a5c1fccc4e2 /src/mongo/db/commands/find_cmd.cpp
parent29801279ed59068602d2961cafa2193c3e477879 (diff)
downloadmongo-43cf2cd5f8ac1144e24323ef183ee21a024a9de9.tar.gz
SERVER-62025 Only use CQF path for eligible queries and fallback to classic optimizer otherwise
Diffstat (limited to 'src/mongo/db/commands/find_cmd.cpp')
-rw-r--r--src/mongo/db/commands/find_cmd.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index 756e0e265b0..eda3c32b291 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/client.h"
#include "mongo/db/clientcursor.h"
#include "mongo/db/commands.h"
+#include "mongo/db/commands/cqf/cqf_command_utils.h"
#include "mongo/db/commands/run_aggregate.h"
#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/cursor_manager.h"
@@ -301,9 +302,8 @@ public:
// 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())) {
+ isEligibleForBonsai(
+ cq->getFindCommandRequest(), *cq->root(), opCtx, ctx->getCollection())) {
// Relinquish locks. The aggregation command will re-acquire them.
ctx.reset();
@@ -507,9 +507,8 @@ public:
// 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())) {
+ isEligibleForBonsai(
+ cq->getFindCommandRequest(), *cq->root(), opCtx, ctx->getCollection())) {
// Relinquish locks. The aggregation command will re-acquire them.
ctx.reset();