summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/killcursors_cmd.cpp
diff options
context:
space:
mode:
authorIan Boros <ian.boros@10gen.com>2018-01-10 11:41:37 -0500
committerIan Boros <ian.boros@10gen.com>2018-01-10 11:41:37 -0500
commitda80e97d103434a6bc566c589a23af13477e1a28 (patch)
treeebf3227fcc30feb6d8c9a0742b20e956ecf25e58 /src/mongo/db/commands/killcursors_cmd.cpp
parentba1d0d901ef386310457b03eecf9f5c4afce9047 (diff)
downloadmongo-da80e97d103434a6bc566c589a23af13477e1a28.tar.gz
SERVER-21710 Add ability to kill pinned cursors on mongod
Diffstat (limited to 'src/mongo/db/commands/killcursors_cmd.cpp')
-rw-r--r--src/mongo/db/commands/killcursors_cmd.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/mongo/db/commands/killcursors_cmd.cpp b/src/mongo/db/commands/killcursors_cmd.cpp
index dbee95b4976..512ec7e0e94 100644
--- a/src/mongo/db/commands/killcursors_cmd.cpp
+++ b/src/mongo/db/commands/killcursors_cmd.cpp
@@ -51,14 +51,7 @@ private:
Status _checkAuth(Client* client, const NamespaceString& nss, CursorId id) const final {
auto opCtx = client->getOperationContext();
const auto check = [client, opCtx, id](CursorManager* manager) {
- auto ccPin = manager->pinCursor(opCtx, id, CursorManager::kNoCheckSession);
- if (!ccPin.isOK()) {
- return ccPin.getStatus();
- }
-
- const auto* cursor = ccPin.getValue().getCursor();
- AuthorizationSession* as = AuthorizationSession::get(client);
- return as->checkAuthForKillCursors(cursor->nss(), cursor->getAuthenticatedUsers());
+ return manager->checkAuthForKillCursors(opCtx, id);
};
return CursorManager::withCursorManager(opCtx, id, nss, check);
@@ -80,7 +73,7 @@ private:
return CursorManager::withCursorManager(
opCtx, id, nss, [opCtx, id](CursorManager* manager) {
- return manager->eraseCursor(opCtx, id, true /* shouldAudit */);
+ return manager->killCursor(opCtx, id, true /* shouldAudit */);
});
}
} killCursorsCmd;