From 5b73c31741584597bae0455a50364513c05dc1d1 Mon Sep 17 00:00:00 2001 From: Anton Oyung Date: Tue, 19 Nov 2019 15:51:41 +0000 Subject: SERVER-36439 Fix the concurrency control of the LogicalTimeValidator --- src/mongo/db/logical_time_validator.cpp | 10 ++-------- src/mongo/db/logical_time_validator.h | 2 -- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/mongo/db/logical_time_validator.cpp b/src/mongo/db/logical_time_validator.cpp index df814663ff6..6d448f78a5f 100644 --- a/src/mongo/db/logical_time_validator.cpp +++ b/src/mongo/db/logical_time_validator.cpp @@ -173,7 +173,6 @@ void LogicalTimeValidator::init(ServiceContext* service) { } void LogicalTimeValidator::shutDown() { - stdx::lock_guard lk(_mutexKeyManager); if (_keyManager) { _keyManager->stopMonitoring(); } @@ -197,18 +196,14 @@ bool LogicalTimeValidator::shouldGossipLogicalTime() { void LogicalTimeValidator::resetKeyManagerCache() { log() << "Resetting key manager cache"; - { - stdx::lock_guard keyManagerLock(_mutexKeyManager); - invariant(_keyManager); - _keyManager->clearCache(); - } + invariant(_keyManager); + _keyManager->clearCache(); stdx::lock_guard lk(_mutex); _lastSeenValidTime = SignedLogicalTime(); _timeProofService.resetCache(); } void LogicalTimeValidator::stopKeyManager() { - stdx::lock_guard keyManagerLock(_mutexKeyManager); if (_keyManager) { log() << "Stopping key manager"; _keyManager->stopMonitoring(); @@ -223,7 +218,6 @@ void LogicalTimeValidator::stopKeyManager() { } std::shared_ptr LogicalTimeValidator::_getKeyManagerCopy() { - stdx::lock_guard lk(_mutexKeyManager); invariant(_keyManager); return _keyManager; } diff --git a/src/mongo/db/logical_time_validator.h b/src/mongo/db/logical_time_validator.h index e639b4435d8..1e8fbac9933 100644 --- a/src/mongo/db/logical_time_validator.h +++ b/src/mongo/db/logical_time_validator.h @@ -123,8 +123,6 @@ private: SignedLogicalTime _getProof(const KeysCollectionDocument& keyDoc, LogicalTime newTime); Mutex _mutex = MONGO_MAKE_LATCH("LogicalTimeValidator::_mutex"); // protects _lastSeenValidTime - Mutex _mutexKeyManager = - MONGO_MAKE_LATCH("LogicalTimevalidator::_mutexKeyManager"); // protects _keyManager SignedLogicalTime _lastSeenValidTime; TimeProofService _timeProofService; std::shared_ptr _keyManager; -- cgit v1.2.1