diff options
author | Martin Bligh <mbligh@mongodb.com> | 2015-07-06 08:53:23 -0400 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-07-10 11:59:34 +1000 |
commit | 60802d74b1b8df7e194ecc028c8d73e134de791b (patch) | |
tree | 1f8be298ff5352ea426a86434237307049b04247 | |
parent | a07e5b9e9c31bba5d8d6da61c17c2231cb396323 (diff) | |
download | mongo-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.cpp | 2 |
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 |