diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2018-09-17 11:25:15 -0400 |
---|---|---|
committer | Ted Tuckman <ted.tuckman@mongodb.com> | 2018-09-28 11:46:03 -0400 |
commit | a73b2fc77d72a06380826259620f105e179a4c5c (patch) | |
tree | 9d6b43cc70897531a148270098274da49c67e5ea /src/mongo/db/query | |
parent | d8e10f2dcc4554c74cf1da9d40557233cad70fb1 (diff) | |
download | mongo-a73b2fc77d72a06380826259620f105e179a4c5c.tar.gz |
SERVER-37003 Add activeCursor field to curOp for getMore
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/find.cpp | 10 |
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); |