diff options
author | Yuhong Zhang <yuhong.zhang@mongodb.com> | 2022-09-30 19:16:23 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-03 20:12:39 +0000 |
commit | 50e38fa00ad159f2f4c1bd94fcd065ee8a9ce212 (patch) | |
tree | 0da51d0adbc2f79a25118f1b7501f667bab64c11 /src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp | |
parent | ecb738efdcd4d69888039593fbcb91dd10c68cc3 (diff) | |
download | mongo-50e38fa00ad159f2f4c1bd94fcd065ee8a9ce212.tar.gz |
SERVER-69247 Add concurrency control for taking checkpoints
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp')
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp index 22a30da3cb5..c3cfaf7b478 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp @@ -35,6 +35,7 @@ #include <memory> #include "mongo/base/error_codes.h" +#include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/global_settings.h" #include "mongo/db/repl/repl_settings.h" #include "mongo/db/storage/journal_listener.h" @@ -295,6 +296,8 @@ void WiredTigerSessionCache::waitUntilDurable(OperationContext* opCtx, auto config = syncType == Fsync::kCheckpointStableTimestamp ? "use_timestamp=true" : "use_timestamp=false"; { + Lock::ResourceLock checkpointLock{ + opCtx, ResourceId(RESOURCE_MUTEX, "checkpoint"), MODE_X}; _engine->clearIndividuallyCheckpointedIndexes(); invariantWTOK(s->checkpoint(s, config), s); } @@ -349,6 +352,7 @@ void WiredTigerSessionCache::waitUntilDurable(OperationContext* opCtx, _waitUntilDurableSession); LOGV2_DEBUG(22419, 4, "flushed journal"); } else { + Lock::ResourceLock checkpointLock{opCtx, ResourceId(RESOURCE_MUTEX, "checkpoint"), MODE_X}; _engine->clearIndividuallyCheckpointedIndexes(); invariantWTOK(_waitUntilDurableSession->checkpoint(_waitUntilDurableSession, nullptr), _waitUntilDurableSession); |