diff options
author | James Wahlin <james@mongodb.com> | 2018-03-27 16:27:34 -0400 |
---|---|---|
committer | James Wahlin <james@mongodb.com> | 2018-03-28 09:15:21 -0400 |
commit | 9b6da195207b71348dd1811dfbd6f8ca5c9b7428 (patch) | |
tree | efd9f073ffcb9d5237bb0a4fc695aefe08eb7c6b /src/mongo/db/commands/killcursors_cmd.cpp | |
parent | 82e4873c00f01e4dcb5aad4a6550a82ec4aa4a65 (diff) | |
download | mongo-9b6da195207b71348dd1811dfbd6f8ca5c9b7428.tar.gz |
SERVER-34101 Revert change to free transaction resources on snapshot read killCursors
Diffstat (limited to 'src/mongo/db/commands/killcursors_cmd.cpp')
-rw-r--r-- | src/mongo/db/commands/killcursors_cmd.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/mongo/db/commands/killcursors_cmd.cpp b/src/mongo/db/commands/killcursors_cmd.cpp index 453c703dfa4..512ec7e0e94 100644 --- a/src/mongo/db/commands/killcursors_cmd.cpp +++ b/src/mongo/db/commands/killcursors_cmd.cpp @@ -36,7 +36,6 @@ #include "mongo/db/cursor_manager.h" #include "mongo/db/db_raii.h" #include "mongo/db/query/killcursors_request.h" -#include "mongo/db/session_catalog.h" #include "mongo/db/stats/top.h" #include "mongo/util/scopeguard.h" @@ -72,28 +71,10 @@ private: } } - boost::optional<std::pair<LogicalSessionId, TxnNumber>> txnToAbort; - - auto status = CursorManager::withCursorManager( - opCtx, id, nss, [opCtx, id, &txnToAbort](CursorManager* manager) { - auto status = manager->killCursor(opCtx, id, true /* shouldAudit */); - if (status.isOK()) { - txnToAbort = status.getValue(); - } - return status.getStatus(); + return CursorManager::withCursorManager( + opCtx, id, nss, [opCtx, id](CursorManager* manager) { + return manager->killCursor(opCtx, id, true /* shouldAudit */); }); - - // If the cursor has a corresponding transaction, abort that transaction if it is a snapshot - // read. This must be done while we are not holding locks. - invariant(!opCtx->lockState()->isLocked()); - if (txnToAbort) { - auto session = SessionCatalog::get(opCtx)->getSession(opCtx, txnToAbort->first); - if (session) { - (*session)->abortIfSnapshotRead(txnToAbort->second); - } - } - - return status; } } killCursorsCmd; |