diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2021-05-27 09:40:30 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-05 03:18:21 +0000 |
commit | e482b1bc65a667a853ade889055048ca60e43e93 (patch) | |
tree | 813a80cc71c01c39c4bd6237de9e49dc7085d2df /src/mongo/dbtests/storage_timestamp_tests.cpp | |
parent | 869cc8b7e961691d022dc4fbc08baba585d66221 (diff) | |
download | mongo-e482b1bc65a667a853ade889055048ca60e43e93.tar.gz |
SERVER-57173: Add distinction to oplog application when data is inconsistent.
(cherry picked from commit 3b6a717a226a86832979f8a5b0b8bf5eef9bb51c)
Diffstat (limited to 'src/mongo/dbtests/storage_timestamp_tests.cpp')
-rw-r--r-- | src/mongo/dbtests/storage_timestamp_tests.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index dd25e73d3b0..8b4cfdc3cf2 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -801,8 +801,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()); @@ -2876,7 +2877,8 @@ public: Status applyOplogBatchPerWorker(OperationContext* opCtx, std::vector<const repl::OplogEntry*>* operationsToApply, - WorkerMultikeyPathInfo* pathInfo) override; + WorkerMultikeyPathInfo* pathInfo, + bool isDataConsistent) override; private: // Pointer to the test's op context. This is distinct from the op context used in @@ -2893,13 +2895,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; } @@ -3232,8 +3237,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. @@ -3259,8 +3265,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); |