summaryrefslogtreecommitdiff
path: root/src/mongo/db/session_catalog.h
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2022-06-03 15:24:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-03 15:59:44 +0000
commitd457fc3a9723edc094bd7dc45bcf00112cad57c6 (patch)
treeda5b06d38d9c27c7acb146a408382ec58ad2d562 /src/mongo/db/session_catalog.h
parentca1befe5258cf5578ea540f2926000c7152b0dad (diff)
downloadmongo-d457fc3a9723edc094bd7dc45bcf00112cad57c6.tar.gz
SERVER-66992 Optimize how often SessionCatalog mutex is held
Diffstat (limited to 'src/mongo/db/session_catalog.h')
-rw-r--r--src/mongo/db/session_catalog.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/mongo/db/session_catalog.h b/src/mongo/db/session_catalog.h
index 8186e2fcc60..b1a600989b0 100644
--- a/src/mongo/db/session_catalog.h
+++ b/src/mongo/db/session_catalog.h
@@ -103,7 +103,10 @@ public:
* Iterates through the SessionCatalog and applies 'workerFn' to each Session. This locks the
* SessionCatalog.
*/
- void scanSession(const LogicalSessionId& lsid, const ScanSessionsCallbackFn& workerFn);
+ enum class ScanSessionCreateSession { kYes, kNo };
+ void scanSession(const LogicalSessionId& lsid,
+ const ScanSessionsCallbackFn& workerFn,
+ ScanSessionCreateSession createSession = ScanSessionCreateSession::kNo);
void scanSessions(const SessionKiller::Matcher& matcher,
const ScanSessionsCallbackFn& workerFn);
@@ -135,11 +138,6 @@ public:
*/
size_t size() const;
- /**
- * Creates the session runtime info for 'lsid' if it doesn't exist.
- */
- void createSessionIfDoesNotExist(const LogicalSessionId& lsid);
-
private:
/**
* Tracks the runtime info for transaction sessions that corresponds to the same logical
@@ -149,7 +147,7 @@ private:
struct SessionRuntimeInfo {
SessionRuntimeInfo(LogicalSessionId lsid) : parentSession(std::move(lsid)) {
// Can only create a SessionRuntimeInfo with a parent transaction session id.
- invariant(!getParentSessionId(lsid));
+ invariant(isParentSessionId(lsid));
}
Session* getSession(WithLock, const LogicalSessionId& lsid);