diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2022-01-15 15:06:18 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-15 15:42:52 +0000 |
commit | e60858dc5165457c7c5f8574af8d2dead06143d0 (patch) | |
tree | 7ddd3fc76cd0b1ca9c1fda8af0b79ac66a931a2d /src/mongo/dbtests | |
parent | 584079c8c3dfe16741deb35e5e643c2f8637145b (diff) | |
download | mongo-e60858dc5165457c7c5f8574af8d2dead06143d0.tar.gz |
SERVER-58410: Make minValid writes untimestamped
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r-- | src/mongo/dbtests/storage_timestamp_tests.cpp | 71 |
1 files changed, 5 insertions, 66 deletions
diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index dee63ba5bcc..33f4a23b6f8 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -1847,25 +1847,18 @@ public: expectedMinValidWithSetFlag.setInitialSyncFlag(true); assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidWithSetFlag); - assertMinValidDocumentAtTimestamp(nss, pastTs, expectedMinValidWithSetFlag); - assertMinValidDocumentAtTimestamp(nss, presentTs, expectedMinValidWithSetFlag); - assertMinValidDocumentAtTimestamp(nss, futureTs, expectedMinValidWithSetFlag); consistencyMarkers.clearInitialSyncFlag(_opCtx); repl::MinValidDocument expectedMinValidWithUnsetFlag; - expectedMinValidWithUnsetFlag.setMinValidTerm(presentTerm); - expectedMinValidWithUnsetFlag.setMinValidTimestamp(presentTs); - expectedMinValidWithUnsetFlag.setAppliedThrough(repl::OpTime(presentTs, presentTerm)); + expectedMinValidWithSetFlag.setMinValidTerm(repl::OpTime::kUninitializedTerm); + expectedMinValidWithSetFlag.setMinValidTimestamp(nullTs); assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidWithUnsetFlag); - assertMinValidDocumentAtTimestamp(nss, pastTs, expectedMinValidWithUnsetFlag); - assertMinValidDocumentAtTimestamp(nss, presentTs, expectedMinValidWithUnsetFlag); - assertMinValidDocumentAtTimestamp(nss, futureTs, expectedMinValidWithUnsetFlag); } }; -class SetMinValidToAtLeast : public StorageTimestampTest { +class SetMinValidAppliedThrough : public StorageTimestampTest { public: void run() { NamespaceString nss(repl::ReplicationConsistencyMarkersImpl::kDefaultMinValidNamespace); @@ -1875,76 +1868,23 @@ public: repl::StorageInterface::get(_opCtx)); consistencyMarkers.initializeMinValidDocument(_opCtx); - // Setting minValid sets it at the provided OpTime. - consistencyMarkers.setMinValidToAtLeast(_opCtx, repl::OpTime(presentTs, presentTerm)); - repl::MinValidDocument expectedMinValidInit; expectedMinValidInit.setMinValidTerm(repl::OpTime::kUninitializedTerm); expectedMinValidInit.setMinValidTimestamp(nullTs); - - repl::MinValidDocument expectedMinValidPresent; - expectedMinValidPresent.setMinValidTerm(presentTerm); - expectedMinValidPresent.setMinValidTimestamp(presentTs); - - assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidPresent); - assertMinValidDocumentAtTimestamp(nss, pastTs, expectedMinValidInit); - assertMinValidDocumentAtTimestamp(nss, presentTs, expectedMinValidPresent); - assertMinValidDocumentAtTimestamp(nss, futureTs, expectedMinValidPresent); - - consistencyMarkers.setMinValidToAtLeast(_opCtx, repl::OpTime(futureTs, presentTerm)); - - repl::MinValidDocument expectedMinValidFuture; - expectedMinValidFuture.setMinValidTerm(presentTerm); - expectedMinValidFuture.setMinValidTimestamp(futureTs); - - assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidFuture); - assertMinValidDocumentAtTimestamp(nss, pastTs, expectedMinValidInit); - assertMinValidDocumentAtTimestamp(nss, presentTs, expectedMinValidPresent); - assertMinValidDocumentAtTimestamp(nss, futureTs, expectedMinValidFuture); - - // Setting the timestamp to the past should be a noop. - consistencyMarkers.setMinValidToAtLeast(_opCtx, repl::OpTime(pastTs, presentTerm)); - - assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidFuture); - assertMinValidDocumentAtTimestamp(nss, pastTs, expectedMinValidInit); - assertMinValidDocumentAtTimestamp(nss, presentTs, expectedMinValidPresent); - assertMinValidDocumentAtTimestamp(nss, futureTs, expectedMinValidFuture); - } -}; - -class SetMinValidAppliedThrough : public StorageTimestampTest { -public: - void run() { - NamespaceString nss(repl::ReplicationConsistencyMarkersImpl::kDefaultMinValidNamespace); - reset(nss); - - repl::ReplicationConsistencyMarkersImpl consistencyMarkers( - repl::StorageInterface::get(_opCtx)); - consistencyMarkers.initializeMinValidDocument(_opCtx); + assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidInit); consistencyMarkers.setAppliedThrough(_opCtx, repl::OpTime(presentTs, presentTerm)); - repl::MinValidDocument expectedMinValidInit; - expectedMinValidInit.setMinValidTerm(repl::OpTime::kUninitializedTerm); - expectedMinValidInit.setMinValidTimestamp(nullTs); - repl::MinValidDocument expectedMinValidPresent; expectedMinValidPresent.setMinValidTerm(repl::OpTime::kUninitializedTerm); expectedMinValidPresent.setMinValidTimestamp(nullTs); expectedMinValidPresent.setAppliedThrough(repl::OpTime(presentTs, presentTerm)); assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidPresent); - assertMinValidDocumentAtTimestamp(nss, pastTs, expectedMinValidInit); - assertMinValidDocumentAtTimestamp(nss, presentTs, expectedMinValidPresent); - assertMinValidDocumentAtTimestamp(nss, futureTs, expectedMinValidPresent); // appliedThrough opTime can be unset. - consistencyMarkers.clearAppliedThrough(_opCtx, futureTs); - + consistencyMarkers.clearAppliedThrough(_opCtx); assertMinValidDocumentAtTimestamp(nss, nullTs, expectedMinValidInit); - assertMinValidDocumentAtTimestamp(nss, pastTs, expectedMinValidInit); - assertMinValidDocumentAtTimestamp(nss, presentTs, expectedMinValidPresent); - assertMinValidDocumentAtTimestamp(nss, futureTs, expectedMinValidInit); } }; @@ -4441,7 +4381,6 @@ public: addIf<PrimarySetsMultikeyInsideMultiDocumentTransaction>(); addIf<InitializeMinValid>(); addIf<SetMinValidInitialSyncFlag>(); - addIf<SetMinValidToAtLeast>(); addIf<SetMinValidAppliedThrough>(); // KVDropDatabase<SimulatePrimary> addIf<KVDropDatabase<false>>(); |