diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-11-01 14:10:41 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-01 14:10:41 +0000 |
commit | 6e1889fb793e1927a5ca695c8839f9184e5d8aa4 (patch) | |
tree | fec3ef6deee1794547212d66ea529fa2ca22cd5a /src/mongo/db/cloner.cpp | |
parent | 3439b0f87953229ab0f4153abe134db117fb5db5 (diff) | |
download | mongo-6e1889fb793e1927a5ca695c8839f9184e5d8aa4.tar.gz |
SERVER-44028 Remove global X lock for Cloner
Diffstat (limited to 'src/mongo/db/cloner.cpp')
-rw-r--r-- | src/mongo/db/cloner.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index f20bdc28676..9c547811e69 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -101,8 +101,8 @@ struct Cloner::Fun { : lastLog(0), opCtx(opCtx), _dbName(dbName) {} void operator()(DBClientCursorBatchIterator& i) { - // XXX: can probably take dblock instead - unique_ptr<Lock::GlobalWrite> globalWriteLock(new Lock::GlobalWrite(opCtx)); + boost::optional<Lock::DBLock> dbLock; + dbLock.emplace(opCtx, _dbName, MODE_X); uassert( ErrorCodes::NotMaster, str::stream() << "Not primary while cloning collection " << from_collection.ns() @@ -159,11 +159,11 @@ struct Cloner::Fun { } opCtx->checkForInterrupt(); - globalWriteLock.reset(); + dbLock.reset(); CurOp::get(opCtx)->yielded(); - globalWriteLock.reset(new Lock::GlobalWrite(opCtx)); + dbLock.emplace(opCtx, _dbName, MODE_X); // Check if everything is still all right. if (opCtx->writesAreReplicated()) { |