summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-04-16 14:02:29 -0400
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-04-25 11:06:12 -0400
commit5ae506cb8fc73074bb46d6be9667ed1825e98d69 (patch)
treea6e27ff6db42388a945ee844c6e51be09bf44dc6 /src
parent935157a3cf54ca802419cd8d92ff4b137fbe2949 (diff)
downloadmongo-5ae506cb8fc73074bb46d6be9667ed1825e98d69.tar.gz
SERVER-39321 Re-enable the CheckReplDBHashInBackground hook
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/dbhash.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 3706db1e133..6a6ab9cd1a3 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -181,11 +181,18 @@ public:
// We lock the entire database in S-mode in order to ensure that the contents will not
// change for the snapshot.
auto lockMode = LockMode::MODE_S;
+ boost::optional<ShouldNotConflictWithSecondaryBatchApplicationBlock> shouldNotConflictBlock;
if (opCtx->recoveryUnit()->getTimestampReadSource() ==
RecoveryUnit::ReadSource::kProvided) {
// However, if we are performing a read at a timestamp, then we only need to lock the
// database in intent mode to ensure that none of the collections get dropped.
lockMode = LockMode::MODE_IS;
+
+ // Additionally, if we are performing a read at a timestamp, then we allow oplog
+ // application to proceed concurrently with the dbHash command. This is done
+ // to ensure a prepare conflict is able to eventually be resolved by processing a
+ // later commitTransaction or abortTransaction oplog entry.
+ shouldNotConflictBlock.emplace(opCtx->lockState());
}
AutoGetDb autoDb(opCtx, ns, lockMode);
Database* db = autoDb.getDb();