diff options
author | Yuhong Zhang <danielzhangyh@gmail.com> | 2021-11-15 18:37:35 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-15 19:02:45 +0000 |
commit | 4cd66c0f2fe2912a5261d26bbc9608873fc22303 (patch) | |
tree | 0726905bffbe279d0b13d379e9bfe997bdfab431 /src/mongo/dbtests/dbhelper_tests.cpp | |
parent | 69f969faf841993a8032b3ca24eb47041695e966 (diff) | |
download | mongo-4cd66c0f2fe2912a5261d26bbc9608873fc22303.tar.gz |
SERVER-60037 Enable the ordered timestamp assertion in MongoDB
Diffstat (limited to 'src/mongo/dbtests/dbhelper_tests.cpp')
-rw-r--r-- | src/mongo/dbtests/dbhelper_tests.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp index 1cb045a381d..dada7c09da1 100644 --- a/src/mongo/dbtests/dbhelper_tests.cpp +++ b/src/mongo/dbtests/dbhelper_tests.cpp @@ -162,6 +162,10 @@ public: { WriteUnitOfWork wuow(opCtx1.get()); BSONObj res; + auto lastApplied = repl::ReplicationCoordinator::get(opCtx1->getServiceContext()) + ->getMyLastAppliedOpTime() + .getTimestamp(); + ASSERT_OK(opCtx1->recoveryUnit()->setTimestamp(lastApplied + 1)); auto foundDoc = Helpers::findByIdAndNoopUpdate(opCtx1.get(), collection1, idQuery, res); wuow.commit(); ASSERT_TRUE(foundDoc); @@ -201,6 +205,10 @@ private: auto collection2 = CollectionCatalog::get(opCtx2)->lookupCollectionByNamespace(opCtx2, nss); ASSERT(collection2 != nullptr); + auto lastApplied = repl::ReplicationCoordinator::get(opCtx2->getServiceContext()) + ->getMyLastAppliedOpTime() + .getTimestamp(); + ASSERT_OK(opCtx2->recoveryUnit()->setTimestamp(lastApplied + 1)); BSONObj res; ASSERT_TRUE(Helpers::findByIdAndNoopUpdate(opCtx2, collection2, idQuery, res)); @@ -233,6 +241,10 @@ private: const BSONObj& idQuery) { { WriteUnitOfWork wuow1(opCtx1); + auto lastApplied = repl::ReplicationCoordinator::get(opCtx1->getServiceContext()) + ->getMyLastAppliedOpTime() + .getTimestamp(); + ASSERT_OK(opCtx1->recoveryUnit()->setTimestamp(lastApplied + 1)); Helpers::emptyCollection(opCtx1, nss); { |