summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/find_cmd.cpp
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2022-01-20 18:06:15 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-21 00:03:35 +0000
commit1a47e71ba861449fffb7feeb05f79c2f1d99497c (patch)
treefb9fc5e8a0777d94f603192a093717d12220ab42 /src/mongo/db/commands/find_cmd.cpp
parente60e92b942dada5ad4e71739b8b194b7c7ca4547 (diff)
downloadmongo-1a47e71ba861449fffb7feeb05f79c2f1d99497c.tar.gz
Revert "SERVER-60742 Maintain RecoveryUnit and storage resources across getMores for non-exchange aggregation operations"
This reverts commit d8afa17c615c274390899917d19180e374040f3e.
Diffstat (limited to 'src/mongo/db/commands/find_cmd.cpp')
-rw-r--r--src/mongo/db/commands/find_cmd.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index d8878f71558..665a58c0850 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -358,13 +358,11 @@ public:
// Get the execution plan for the query.
bool permitYield = true;
- const bool allowMaintainValidCursorsAcrossCommands = true;
auto exec =
uassertStatusOK(getExecutorFind(opCtx,
&collection,
std::move(cq),
nullptr /* extractAndAttachPipelineStages */,
- allowMaintainValidCursorsAcrossCommands,
permitYield));
auto bodyBuilder = result->getBodyBuilder();
@@ -560,9 +558,19 @@ public:
&collection,
std::move(cq),
nullptr /* extractAndAttachPipelineStages */,
- true, /* allow saving cursors across commands */
permitYield));
+ // If the executor supports it, find operations will maintain the storage engine state
+ // across commands.
+ if (serverGlobalParams.featureCompatibility.isVersionInitialized() &&
+ feature_flags::gYieldingSupportForSBE.isEnabled(
+ serverGlobalParams.featureCompatibility) &&
+ !opCtx->inMultiDocumentTransaction() &&
+ repl::ReadConcernArgs::get(opCtx).getLevel() !=
+ repl::ReadConcernLevel::kSnapshotReadConcern) {
+ exec->enableSaveRecoveryUnitAcrossCommandsIfSupported();
+ }
+
{
stdx::lock_guard<Client> lk(*opCtx->getClient());
CurOp::get(opCtx)->setPlanSummary_inlock(exec->getPlanExplainer().getPlanSummary());
@@ -649,9 +657,6 @@ public:
ClientCursorPin pinnedCursor = CursorManager::get(opCtx)->registerCursor(
opCtx,
{std::move(exec),
- nullptr, // nullptr RecoveryUnit. The opCtx's RecoveryUnit will be stashed on
- // Pin destruct if saving cursors across find/getMore commands is
- // supported.
nss,
AuthorizationSession::get(opCtx->getClient())->getAuthenticatedUserNames(),
APIParameters::get(opCtx),