summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Boros <ian.boros@10gen.com>2018-11-19 15:42:00 -0500
committerIan Boros <ian.boros@10gen.com>2018-12-12 11:42:29 -0500
commit3a76585f4e5d53fc380e0c0db44fd06f45dcdb24 (patch)
treeaf5c7fb51f0174b95075ebda989b16b38b37f8d4 /src
parent5a4fa1d1d7bb23939c104432bb8297778a69e7cc (diff)
downloadmongo-3a76585f4e5d53fc380e0c0db44fd06f45dcdb24.tar.gz
SERVER-37838 prevent crash with getMore and simultaneous stepdown
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/cursor_manager.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/db/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp
index 092e95eedb0..03caf70537b 100644
--- a/src/mongo/db/cursor_manager.cpp
+++ b/src/mongo/db/cursor_manager.cpp
@@ -185,9 +185,8 @@ bool GlobalCursorIdCache::killCursor(OperationContext* opCtx, CursorId id, bool
if (CursorManager::isGloballyManagedCursor(id)) {
auto pin = globalCursorManager->pinCursor(opCtx, id, CursorManager::kNoCheckSession);
if (!pin.isOK()) {
- invariant(pin == ErrorCodes::CursorNotFound || pin == ErrorCodes::Unauthorized);
- // No such cursor. TODO: Consider writing to audit log here (even though we don't
- // have a namespace).
+ // Either the cursor doesn't exist, or it was killed during the last time it was being
+ // used, and was cleaned up after this call. Either way, we cannot kill it.
return false;
}
nss = pin.getValue().getCursor()->nss();
@@ -196,8 +195,7 @@ bool GlobalCursorIdCache::killCursor(OperationContext* opCtx, CursorId id, bool
uint32_t nsid = idFromCursorId(id);
IdToNssMap::const_iterator it = _idToNss.find(nsid);
if (it == _idToNss.end()) {
- // No namespace corresponding to this cursor id prefix. TODO: Consider writing to
- // audit log here (even though we don't have a namespace).
+ // No namespace corresponding to this cursor id prefix.
return false;
}
nss = it->second;