summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Bligh <mbligh@mongodb.com>2015-07-06 08:53:23 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2015-07-10 11:59:34 +1000
commit60802d74b1b8df7e194ecc028c8d73e134de791b (patch)
tree1f8be298ff5352ea426a86434237307049b04247
parenta07e5b9e9c31bba5d8d6da61c17c2231cb396323 (diff)
downloadmongo-60802d74b1b8df7e194ecc028c8d73e134de791b.tar.gz
SERVER-19189: dont check sessions is empty outside of the lock
Technically it's illegal to check this outside the lock, though it's heuristic However, it's the unlikely case and we end up doing the work twice, so it seems cleaner to remove it and just do it inside the lock. Checked perf, no measurable difference (cherry picked from commit 90f72ea0b819335e55a6ddd147d5c8d4afa3c988)
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
index 0431748915f..a97d551e2d9 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
@@ -182,7 +182,7 @@ namespace mongo {
_highWaterMark.store(_sessionsOut.load());
}
- if (!_sessions.empty()) {
+ {
boost::lock_guard<SpinLock> lock(_cacheLock);
if (!_sessions.empty()) {
// Get the most recently used session so that if we discard sessions, we're