diff options
author | Blake Oler <blake.oler@mongodb.com> | 2019-06-17 15:23:04 -0400 |
---|---|---|
committer | Blake Oler <blake.oler@mongodb.com> | 2019-06-25 15:40:13 -0400 |
commit | 25035db4996eec5629014f1212413f7cbc5583b1 (patch) | |
tree | 2db0729f317b22618bc31f89496cf00054c05078 | |
parent | 36b70f1e39bbde5eef232982300f7b6a4044914a (diff) | |
download | mongo-25035db4996eec5629014f1212413f7cbc5583b1.tar.gz |
SERVER-41004 Allow CursorNotFound errors to count as a successful kill in the killSessions command
(cherry picked from commit a0c6dc635efc4f14144fa292a626bde63656fbf8)
-rw-r--r-- | src/mongo/db/kill_sessions_common.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/kill_sessions_common.h b/src/mongo/db/kill_sessions_common.h index 255ac6cde86..ff69e502211 100644 --- a/src/mongo/db/kill_sessions_common.h +++ b/src/mongo/db/kill_sessions_common.h @@ -89,7 +89,7 @@ public: : _opCtx(opCtx), _matcher(matcher), _cursorsKilled(0), _eraser(eraser) {} template <typename Mgr> - void operator()(Mgr& mgr) { + void operator()(Mgr& mgr) noexcept { LogicalSessionIdSet activeSessions; mgr.appendActiveSessions(&activeSessions); @@ -102,8 +102,13 @@ public: try { _eraser(mgr, id); _cursorsKilled++; - } catch (...) { - _failures.push_back(exceptionToStatus()); + } catch (const ExceptionFor<ErrorCodes::CursorNotFound>&) { + // Cursor was killed separately after this command was initiated. Still + // count the cursor as killed here, since the user's request is + // technically satisfied. + _cursorsKilled++; + } catch (const DBException& ex) { + _failures.push_back(ex.toStatus()); } } } |