summaryrefslogtreecommitdiff
path: root/src
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-25 15:40:13 -0400
commit25035db4996eec5629014f1212413f7cbc5583b1 (patch)
tree2db0729f317b22618bc31f89496cf00054c05078 /src
parent36b70f1e39bbde5eef232982300f7b6a4044914a (diff)
downloadmongo-25035db4996eec5629014f1212413f7cbc5583b1.tar.gz
SERVER-41004 Allow CursorNotFound errors to count as a successful kill in the killSessions command
(cherry picked from commit a0c6dc635efc4f14144fa292a626bde63656fbf8)
Diffstat (limited to 'src')
-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 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());
}
}
}