summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/find.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/find.cpp')
-rw-r--r--src/mongo/db/query/find.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index b295df1d5e7..6a43af3c64f 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/clientcursor.h"
#include "mongo/db/commands.h"
#include "mongo/db/curop.h"
+#include "mongo/db/curop_failpoint_helpers.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/filter.h"
#include "mongo/db/exec/working_set_common.h"
@@ -73,6 +74,9 @@ using stdx::make_unique;
// Failpoint for checking whether we've received a getmore.
MONGO_FAIL_POINT_DEFINE(failReceivedGetmore);
+// Failpoint to keep a cursor pinned.
+MONGO_FAIL_POINT_DEFINE(legacyGetMoreWaitWithCursor)
+
bool shouldSaveCursor(OperationContext* opCtx,
const Collection* collection,
PlanExecutor::ExecState finalState,
@@ -404,6 +408,8 @@ Message getMore(OperationContext* opCtx,
// command or upconverted legacy query in the originatingCommand field.
curOp.setOpDescription_inlock(upconvertGetMoreEntry(nss, cursorid, ntoreturn));
curOp.setOriginatingCommand_inlock(cc->getOriginatingCommandObj());
+ // Update the generic cursor in curOp.
+ curOp.setGenericCursor_inlock(cc->toGenericCursor());
}
PlanExecutor::ExecState state;
@@ -413,6 +419,10 @@ Message getMore(OperationContext* opCtx,
// metrics, as they accumulate over the course of a cursor's lifetime.
PlanSummaryStats preExecutionStats;
Explain::getSummaryStats(*exec, &preExecutionStats);
+ if (MONGO_FAIL_POINT(legacyGetMoreWaitWithCursor)) {
+ CurOpFailpointHelpers::waitWhileFailPointEnabled(
+ &legacyGetMoreWaitWithCursor, opCtx, "legacyGetMoreWaitWithCursor", nullptr);
+ }
generateBatch(ntoreturn, cc, &bb, &numResults, &state);