summaryrefslogtreecommitdiff
path: root/src/mongo/db/kill_sessions_common.h
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2019-06-17 15:23:04 -0400
committerBlake Oler <blake.oler@mongodb.com>2019-06-19 15:25:38 -0400
commita0c6dc635efc4f14144fa292a626bde63656fbf8 (patch)
tree55f64b2fa19644f8d517e99d7ba41b4a470d5d67 /src/mongo/db/kill_sessions_common.h
parent303adb5e50eb02d077b734aa27ae8d02a781d7a2 (diff)
downloadmongo-a0c6dc635efc4f14144fa292a626bde63656fbf8.tar.gz
SERVER-41004 Allow CursorNotFound errors to count as a successful kill in the killSessions command
Diffstat (limited to 'src/mongo/db/kill_sessions_common.h')
-rw-r--r--src/mongo/db/kill_sessions_common.h11
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 2200183fe73..5e749709a1b 100644
--- a/src/mongo/db/kill_sessions_common.h
+++ b/src/mongo/db/kill_sessions_common.h
@@ -92,7 +92,7 @@ public:
* which this adaptor was constructed.
*/
template <typename Mgr>
- void operator()(Mgr& mgr) {
+ void operator()(Mgr& mgr) noexcept {
LogicalSessionIdSet activeSessions;
mgr.appendActiveSessions(&activeSessions);
@@ -105,8 +105,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());
}
}
}