diff options
author | Jason Zhang <jason.zhang@mongodb.com> | 2021-09-14 19:12:48 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-14 19:37:25 +0000 |
commit | 65403939d82d49dd2175204845c68a819de27831 (patch) | |
tree | cdbb46b227ce4435a0f096a90d83aa68ed3eef30 /src/mongo/db/session_killer.cpp | |
parent | 4e3787d83b0247aef9a9d27e25c00de21065c08f (diff) | |
download | mongo-65403939d82d49dd2175204845c68a819de27831.tar.gz |
SERVER-58755 Manage lifetime of internal sessions and transactions
Diffstat (limited to 'src/mongo/db/session_killer.cpp')
-rw-r--r-- | src/mongo/db/session_killer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/session_killer.cpp b/src/mongo/db/session_killer.cpp index 9f37dc9e3c6..c63dddc594c 100644 --- a/src/mongo/db/session_killer.cpp +++ b/src/mongo/db/session_killer.cpp @@ -32,6 +32,7 @@ #include "mongo/db/session_killer.h" #include "mongo/db/client.h" +#include "mongo/db/logical_session_id_helpers.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" #include "mongo/util/destructor_guard.h" @@ -112,15 +113,19 @@ const KillAllSessionsByPattern* SessionKiller::Matcher::match(const LogicalSessi return _killAll; } + // Since child and parent sessions are logically related, by default, we will convert any child + // lsid to its corresponding parent lsid and match based on the converted lsid. + auto parentSessionId = castToParentSessionId(lsid); + { - auto iter = _lsids.find(lsid); + auto iter = _lsids.find(parentSessionId); if (iter != _lsids.end()) { return iter->second; } } { - auto iter = _uids.find(lsid.getUid()); + auto iter = _uids.find(parentSessionId.getUid()); if (iter != _uids.end()) { return iter->second; } |