diff options
author | James Wahlin <james@mongodb.com> | 2018-03-27 11:20:13 -0400 |
---|---|---|
committer | James Wahlin <james@mongodb.com> | 2018-04-16 14:33:12 -0400 |
commit | 9652d252a2932fc0096704fccb1152b6b290fe6f (patch) | |
tree | b5a6b0f0f23ef1c1e9c9924c37e8d1d5eedc39e1 /src/mongo/db/commands | |
parent | c02574298a711b6de8a3d89cedcfe98040a6f55b (diff) | |
download | mongo-9652d252a2932fc0096704fccb1152b6b290fe6f.tar.gz |
SERVER-33690 Transaction abort and commit should kill any associated client cursors
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/find_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/getmore_cmd.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/commands/parallel_collection_scan.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/commands/run_aggregate.cpp | 1 |
4 files changed, 1 insertions, 13 deletions
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 875638e46c2..f00f42cc9fd 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -399,8 +399,6 @@ public: } pinnedCursor.getCursor()->setPos(numResults); - opCtx->setStashedCursor(); - // Fill out curop based on the results. endQueryOp(opCtx, collection, *cursorExec, numResults, cursorId); } else { diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index e62e3667afd..83188a92793 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -217,10 +217,6 @@ public: const GetMoreRequest& request, const BSONObj& cmdObj, BSONObjBuilder& result) { - // If we return early without freeing the cursor, indicate we have a stashed cursor, so that - // transaction state is stashed. - ScopeGuard stashedCursorIndicator = MakeGuard(&OperationContext::setStashedCursor, opCtx); - auto curOp = CurOp::get(opCtx); curOp->debug().cursorid = request.cursorid; @@ -355,10 +351,8 @@ public: return CommandHelpers::appendCommandStatus(result, status); } - // On early return, get rid of the cursor. We should no longer indicate we have a stashed - // cursor on early return. + // On early return, get rid of the cursor. ScopeGuard cursorFreer = MakeGuard(&ClientCursorPin::deleteUnderlying, &ccPin.getValue()); - stashedCursorIndicator.Dismiss(); const auto replicationMode = repl::ReplicationCoordinator::get(opCtx)->getReplicationMode(); opCtx->recoveryUnit()->setReadConcernLevelAndReplicationMode(cursor->getReadConcernLevel(), @@ -472,8 +466,6 @@ public: cursor->setLeftoverMaxTimeMicros(opCtx->getRemainingMaxTimeMicros()); cursor->incPos(numResults); - - opCtx->setStashedCursor(); } else { curOp->debug().cursorExhausted = true; } diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index ae3818ab9ea..ea18c824716 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -174,7 +174,6 @@ public: bucketsBuilder.append(threadResult.obj()); } result.appendArray("cursors", bucketsBuilder.obj()); - opCtx->setStashedCursor(); return true; } diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp index 3529cce56e9..2f068165ed9 100644 --- a/src/mongo/db/commands/run_aggregate.cpp +++ b/src/mongo/db/commands/run_aggregate.cpp @@ -529,7 +529,6 @@ Status runAggregate(OperationContext* opCtx, const bool keepCursor = handleCursorCommand(opCtx, origNss, pin.getCursor(), request, result); if (keepCursor) { - opCtx->setStashedCursor(); cursorFreer.Dismiss(); } } |