diff options
-rw-r--r-- | src/mongo/db/repl/session_update_tracker.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/repl/session_update_tracker.h | 3 | ||||
-rw-r--r-- | src/mongo/db/session_catalog.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/session_catalog.h | 6 |
4 files changed, 8 insertions, 11 deletions
diff --git a/src/mongo/db/repl/session_update_tracker.cpp b/src/mongo/db/repl/session_update_tracker.cpp index 9988a3832b9..5aa2152f5a0 100644 --- a/src/mongo/db/repl/session_update_tracker.cpp +++ b/src/mongo/db/repl/session_update_tracker.cpp @@ -65,9 +65,9 @@ void SessionUpdateTracker::_updateSessionInfo(const OplogEntry& entry) { const auto& lsid = sessionInfo.getSessionId(); invariant(lsid); - auto iter = _sessionsToUpdate.find(lsid->getId()); + auto iter = _sessionsToUpdate.find(*lsid); if (iter == _sessionsToUpdate.end()) { - _sessionsToUpdate.emplace(lsid->getId(), entry); + _sessionsToUpdate.emplace(*lsid, entry); return; } @@ -77,7 +77,7 @@ void SessionUpdateTracker::_updateSessionInfo(const OplogEntry& entry) { return; } - severe() << "Entry for session " << lsid->getId() << " has txnNumber " + severe() << "Entry for session " << lsid->toBSON() << " has txnNumber " << *sessionInfo.getTxnNumber() << " < " << *existingSessionInfo.getTxnNumber(); severe() << "New oplog entry: " << redact(entry.toString()); severe() << "Existing oplog entry: " << redact(iter->second.toString()); @@ -125,7 +125,7 @@ std::vector<OplogEntry> SessionUpdateTracker::_flushForQueryPredicate( const BSONObj& queryPredicate) { auto idField = queryPredicate["_id"].Obj(); auto lsid = LogicalSessionId::parse(IDLParserErrorContext("lsidInOplogQuery"), idField); - auto iter = _sessionsToUpdate.find(lsid.getId()); + auto iter = _sessionsToUpdate.find(lsid); if (iter == _sessionsToUpdate.end()) { return {}; diff --git a/src/mongo/db/repl/session_update_tracker.h b/src/mongo/db/repl/session_update_tracker.h index e4288324337..959ab190801 100644 --- a/src/mongo/db/repl/session_update_tracker.h +++ b/src/mongo/db/repl/session_update_tracker.h @@ -35,6 +35,7 @@ #include <vector> #include "mongo/bson/bsonobj.h" +#include "mongo/db/logical_session_id.h" #include "mongo/db/repl/oplog_entry.h" #include "mongo/util/uuid.h" @@ -82,7 +83,7 @@ private: */ void _updateSessionInfo(const OplogEntry& entry); - std::map<UUID, OplogEntry> _sessionsToUpdate; + LogicalSessionIdMap<OplogEntry> _sessionsToUpdate; }; } // namespace repl diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp index 885fabb4190..738997907b0 100644 --- a/src/mongo/db/session_catalog.cpp +++ b/src/mongo/db/session_catalog.cpp @@ -188,7 +188,7 @@ void SessionCatalog::invalidateSessions(OperationContext* opCtx, << " cannot be performed using a transaction or on a session.", !opCtx->getLogicalSessionId()); - const auto invalidateSessionFn = [&](WithLock, SessionRuntimeInfoMap::iterator it) { + const auto invalidateSessionFn = [&](WithLock, decltype(_txnTable)::iterator it) { auto& sri = it->second; sri->txnState.invalidate(); diff --git a/src/mongo/db/session_catalog.h b/src/mongo/db/session_catalog.h index 17cc8e8cf4b..436a6e1f0ad 100644 --- a/src/mongo/db/session_catalog.h +++ b/src/mongo/db/session_catalog.h @@ -143,10 +143,6 @@ private: Session txnState; }; - using SessionRuntimeInfoMap = stdx::unordered_map<LogicalSessionId, - std::shared_ptr<SessionRuntimeInfo>, - LogicalSessionIdHash>; - /** * Must be called with _mutex locked and returns it locked. May release and re-acquire it zero * or more times before returning. The returned 'SessionRuntimeInfo' is guaranteed to be linked @@ -163,7 +159,7 @@ private: ServiceContext* const _serviceContext; stdx::mutex _mutex; - SessionRuntimeInfoMap _txnTable; + LogicalSessionIdMap<std::shared_ptr<SessionRuntimeInfo>> _txnTable; }; /** |