summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2021-05-27 09:40:30 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-27 13:54:33 +0000
commit3b6a717a226a86832979f8a5b0b8bf5eef9bb51c (patch)
tree187c3afd6deec887471d13c0b1daf901692b7138 /src/mongo/dbtests
parentfee3e5de6148b0415ad4b8bef42c53f480ba0ba9 (diff)
downloadmongo-3b6a717a226a86832979f8a5b0b8bf5eef9bb51c.tar.gz
SERVER-57173: Add distinction to oplog application when data is inconsistent.
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/repltests.cpp9
-rw-r--r--src/mongo/dbtests/storage_timestamp_tests.cpp19
2 files changed, 20 insertions, 8 deletions
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index b90fa0ab08e..25f4afc314e 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -249,8 +249,13 @@ protected:
}
repl::UnreplicatedWritesBlock uwb(&_opCtx);
auto entry = uassertStatusOK(OplogEntry::parse(*i));
- uassertStatusOK(applyOperation_inlock(
- &_opCtx, ctx.db(), &entry, false, OplogApplication::Mode::kSecondary));
+ const bool dataIsConsistent = true;
+ uassertStatusOK(applyOperation_inlock(&_opCtx,
+ ctx.db(),
+ &entry,
+ false,
+ OplogApplication::Mode::kSecondary,
+ dataIsConsistent));
}
}
}
diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp
index 41aaa2e7d70..a46f2035e44 100644
--- a/src/mongo/dbtests/storage_timestamp_tests.cpp
+++ b/src/mongo/dbtests/storage_timestamp_tests.cpp
@@ -798,8 +798,9 @@ public:
}
repl::OplogEntryOrGroupedInserts groupedInserts(opPtrs.cbegin(), opPtrs.cend());
+ const bool dataIsConsistent = true;
ASSERT_OK(repl::applyOplogEntryOrGroupedInserts(
- _opCtx, groupedInserts, repl::OplogApplication::Mode::kSecondary));
+ _opCtx, groupedInserts, repl::OplogApplication::Mode::kSecondary, dataIsConsistent));
for (std::int32_t idx = 0; idx < docsToInsert; ++idx) {
OneOffRead oor(_opCtx, firstInsertTime.addTicks(idx).asTimestamp());
@@ -2946,7 +2947,8 @@ public:
Status applyOplogBatchPerWorker(OperationContext* opCtx,
std::vector<const repl::OplogEntry*>* operationsToApply,
- WorkerMultikeyPathInfo* pathInfo) override;
+ WorkerMultikeyPathInfo* pathInfo,
+ const bool isDataConsistent) override;
private:
// Pointer to the test's op context. This is distinct from the op context used in
@@ -2963,13 +2965,16 @@ private:
Status SecondaryReadsDuringBatchApplicationAreAllowedApplier::applyOplogBatchPerWorker(
OperationContext* opCtx,
std::vector<const repl::OplogEntry*>* operationsToApply,
- WorkerMultikeyPathInfo* pathInfo) {
+ WorkerMultikeyPathInfo* pathInfo,
+ const bool isDataConsistent) {
if (!_testOpCtx->lockState()->isLockHeldForMode(resourceIdParallelBatchWriterMode, MODE_X)) {
return {ErrorCodes::BadValue, "Batch applied was not holding PBWM lock in MODE_X"};
}
// Insert the document. A reader without a PBWM lock should not see it yet.
- auto status = OplogApplierImpl::applyOplogBatchPerWorker(opCtx, operationsToApply, pathInfo);
+ const bool dataIsConsistent = true;
+ auto status = OplogApplierImpl::applyOplogBatchPerWorker(
+ opCtx, operationsToApply, pathInfo, dataIsConsistent);
if (!status.isOK()) {
return status;
}
@@ -3288,8 +3293,9 @@ public:
auto start = repl::makeStartIndexBuildOplogEntry(
startBuildOpTime, nss, "field_1", keyPattern, collUUID, indexBuildUUID);
+ const bool dataIsConsistent = true;
ASSERT_OK(repl::applyOplogEntryOrGroupedInserts(
- _opCtx, &start, repl::OplogApplication::Mode::kSecondary));
+ _opCtx, &start, repl::OplogApplication::Mode::kSecondary, dataIsConsistent));
// We cannot use the OperationContext to wait for the thread to reach the fail point
// because it also uses the ClockSourceMock.
@@ -3315,8 +3321,9 @@ public:
auto commit = repl::makeCommitIndexBuildOplogEntry(
startBuildOpTime, nss, "field_1", keyPattern, collUUID, indexBuildUUID);
+ const bool dataIsConsistent = true;
ASSERT_OK(repl::applyOplogEntryOrGroupedInserts(
- _opCtx, &commit, repl::OplogApplication::Mode::kSecondary));
+ _opCtx, &commit, repl::OplogApplication::Mode::kSecondary, dataIsConsistent));
// Reacquire read lock to check index metadata.
AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);