diff options
author | Yuhong Zhang <yuhong.zhang@mongodb.com> | 2023-03-07 22:06:18 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-03-09 07:40:30 +0000 |
commit | d3c2bac08204b3c88c80bc76c7af6b35b3bd1446 (patch) | |
tree | d4231d62ae5e81b0cefc99898b5a7e7b5c8b185f /src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | |
parent | d23e80add65dd44c07272cdcbff7adc6dbdf6a1b (diff) | |
download | mongo-d3c2bac08204b3c88c80bc76c7af6b35b3bd1446.tar.gz |
SERVER-74529 Remove the Checkpoint Lock
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp')
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index de36f8d590a..64a6bfaf9ac 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -143,24 +143,6 @@ constexpr bool kThreadSanitizerEnabled = true; constexpr bool kThreadSanitizerEnabled = false; #endif -class WiredTigerCheckpointLock : public StorageEngine::CheckpointLock { -public: - WiredTigerCheckpointLock(OperationContext* opCtx, StorageEngine::CheckpointLock::Mode mode) - : _lock([&]() -> stdx::variant<Lock::SharedLock, Lock::ExclusiveLock> { - static Lock::ResourceMutex mutex{"checkpoint"}; - switch (mode) { - case StorageEngine::CheckpointLock::Mode::kShared: - return Lock::SharedLock{opCtx, mutex}; - case StorageEngine::CheckpointLock::Mode::kExclusive: - return Lock::ExclusiveLock{opCtx, mutex}; - } - MONGO_UNREACHABLE; - }()) {} - -private: - stdx::variant<Lock::SharedLock, Lock::ExclusiveLock> _lock; -}; - boost::filesystem::path getOngoingBackupPath() { return boost::filesystem::path(storageGlobalParams.dbpath) / WiredTigerBackup::kOngoingBackupFile; @@ -1964,7 +1946,7 @@ void WiredTigerKVEngine::_checkpoint(OperationContext* opCtx, WT_SESSION* sessio // is only to protect our internal updates. // TODO: SERVER-64507: Investigate whether we can smartly rely on one checkpointer if two or // more threads checkpoint at the same time. - auto checkpointLock = getCheckpointLock(opCtx, StorageEngine::CheckpointLock::Mode::kExclusive); + stdx::lock_guard lk(_checkpointMutex); const Timestamp stableTimestamp = getStableTimestamp(); const Timestamp initialDataTimestamp = getInitialDataTimestamp(); @@ -2027,10 +2009,7 @@ void WiredTigerKVEngine::_checkpoint(OperationContext* opCtx, WT_SESSION* sessio } catch (const WriteConflictException&) { LOGV2_WARNING(22346, "Checkpoint encountered a write conflict exception."); } catch (const AssertionException& exc) { - invariant(exc.code() == ErrorCodes::InterruptedAtShutdown || - exc.code() == ErrorCodes::Interrupted, - exc.toString()); - LOGV2(7021300, "Skipping checkpoint due to exception", "exception"_attr = exc.toStatus()); + invariant(ErrorCodes::isShutdownError(exc.code()), exc.what()); } void WiredTigerKVEngine::checkpoint(OperationContext* opCtx) { @@ -2039,11 +2018,6 @@ void WiredTigerKVEngine::checkpoint(OperationContext* opCtx) { return _checkpoint(opCtx, s); } -std::unique_ptr<StorageEngine::CheckpointLock> WiredTigerKVEngine::getCheckpointLock( - OperationContext* opCtx, StorageEngine::CheckpointLock::Mode mode) { - return std::make_unique<WiredTigerCheckpointLock>(opCtx, mode); -} - bool WiredTigerKVEngine::hasIdent(OperationContext* opCtx, StringData ident) const { return _hasUri(WiredTigerRecoveryUnit::get(opCtx)->getSession()->getSession(), _uri(ident)); } |