diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-09-20 11:02:50 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-09-20 11:02:50 -0400 |
commit | b5f2acfe24d1a6363dbcfb558b5baf00684f70e8 (patch) | |
tree | 101505207f2c3adca82750720c7730bb540eeff8 /src/mongo/db/session_catalog.cpp | |
parent | c8cb9cc374af47f862d81e52ad4bc33d96239ef0 (diff) | |
download | mongo-b5f2acfe24d1a6363dbcfb558b5baf00684f70e8.tar.gz |
Revert "SERVER-31114 Perform targeted session invalidation on direct writes to `config.transactions`"
This reverts commit c8cb9cc374af47f862d81e52ad4bc33d96239ef0.
Diffstat (limited to 'src/mongo/db/session_catalog.cpp')
-rw-r--r-- | src/mongo/db/session_catalog.cpp | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp index 8f73410fe1c..f155d10639e 100644 --- a/src/mongo/db/session_catalog.cpp +++ b/src/mongo/db/session_catalog.cpp @@ -104,7 +104,7 @@ boost::optional<UUID> SessionCatalog::getTransactionTableUUID(OperationContext* } void SessionCatalog::onStepUp(OperationContext* opCtx) { - invalidateSessions(opCtx, boost::none); + resetSessions(); DBDirectClient client(opCtx); @@ -172,35 +172,10 @@ ScopedSession SessionCatalog::getOrCreateSession(OperationContext* opCtx, return ss; } -void SessionCatalog::invalidateSessions(OperationContext* opCtx, - boost::optional<BSONObj> singleSessionDoc) { - uassert(40528, - str::stream() << "Direct writes against " - << NamespaceString::kSessionTransactionsTableNamespace.ns() - << " cannot be performed using a transaction or on a session.", - !opCtx->getLogicalSessionId()); - - const auto invalidateSessionFn = [&](WithLock, SessionRuntimeInfoMap::iterator it) { - auto& sri = it->second; - sri->txnState.invalidate(); - _txnTable.erase(it); - }; - +void SessionCatalog::resetSessions() { stdx::lock_guard<stdx::mutex> lg(_mutex); - - if (singleSessionDoc) { - const auto lsid = LogicalSessionId::parse(IDLParserErrorContext("lsid"), - singleSessionDoc->getField("_id").Obj()); - - auto it = _txnTable.find(lsid); - if (it != _txnTable.end()) { - invalidateSessionFn(lg, it); - } - } else { - auto it = _txnTable.begin(); - while (it != _txnTable.end()) { - invalidateSessionFn(lg, it++); - } + for (const auto& it : _txnTable) { + it.second->txnState.invalidate(); } } |