summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_participant_retryable_writes_test.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-12-19 16:36:28 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-12-22 09:11:43 -0500
commitb30c434c313dde1ded0bc0d73d264d27b1eafaa6 (patch)
tree9e356a7c465931dacca25e9da58db349c24dd344 /src/mongo/db/transaction_participant_retryable_writes_test.cpp
parent22d19f03b6ce14b9bc4cacd8c15faa1fa5f15ff2 (diff)
downloadmongo-b30c434c313dde1ded0bc0d73d264d27b1eafaa6.tar.gz
SERVER-38713 Get rid of transaction number equality checking from _makeUpdateRequest/_registerUpdateCacheOnCommit
Diffstat (limited to 'src/mongo/db/transaction_participant_retryable_writes_test.cpp')
-rw-r--r--src/mongo/db/transaction_participant_retryable_writes_test.cpp39
1 files changed, 7 insertions, 32 deletions
diff --git a/src/mongo/db/transaction_participant_retryable_writes_test.cpp b/src/mongo/db/transaction_participant_retryable_writes_test.cpp
index 638f931ef20..0a7f938b391 100644
--- a/src/mongo/db/transaction_participant_retryable_writes_test.cpp
+++ b/src/mongo/db/transaction_participant_retryable_writes_test.cpp
@@ -242,11 +242,11 @@ protected:
txnRecordObj.hasField(SessionTxnRecord::kStateFieldName));
const auto txnParticipant = TransactionParticipant::get(session);
- ASSERT_EQ(opTime, txnParticipant->getLastWriteOpTime(txnNum));
+ ASSERT_EQ(opTime, txnParticipant->getLastWriteOpTime());
txnParticipant->invalidate();
txnParticipant->refreshFromStorageIfNeeded();
- ASSERT_EQ(opTime, txnParticipant->getLastWriteOpTime(txnNum));
+ ASSERT_EQ(opTime, txnParticipant->getLastWriteOpTime());
}
private:
@@ -260,7 +260,7 @@ TEST_F(TransactionParticipantRetryableWritesTest, SessionEntryNotWrittenOnBegin)
const TxnNumber txnNum = 20;
txnParticipant->beginOrContinue(txnNum, boost::none, boost::none);
- ASSERT(txnParticipant->getLastWriteOpTime(txnNum).isNull());
+ ASSERT(txnParticipant->getLastWriteOpTime().isNull());
DBDirectClient client(opCtx());
auto cursor = client.query(NamespaceString::kSessionTransactionsTableNamespace,
@@ -292,7 +292,7 @@ TEST_F(TransactionParticipantRetryableWritesTest, SessionEntryWrittenAtFirstWrit
ASSERT_EQ(txnNum, txnRecord.getTxnNum());
ASSERT_EQ(opTime, txnRecord.getLastWriteOpTime());
ASSERT(!txnRecord.getState());
- ASSERT_EQ(opTime, txnParticipant->getLastWriteOpTime(txnNum));
+ ASSERT_EQ(opTime, txnParticipant->getLastWriteOpTime());
}
TEST_F(TransactionParticipantRetryableWritesTest,
@@ -318,11 +318,11 @@ TEST_F(TransactionParticipantRetryableWritesTest,
ASSERT_EQ(200, txnRecord.getTxnNum());
ASSERT_EQ(secondOpTime, txnRecord.getLastWriteOpTime());
ASSERT(!txnRecord.getState());
- ASSERT_EQ(secondOpTime, txnParticipant->getLastWriteOpTime(200));
+ ASSERT_EQ(secondOpTime, txnParticipant->getLastWriteOpTime());
txnParticipant->invalidate();
txnParticipant->refreshFromStorageIfNeeded();
- ASSERT_EQ(secondOpTime, txnParticipant->getLastWriteOpTime(200));
+ ASSERT_EQ(secondOpTime, txnParticipant->getLastWriteOpTime());
}
TEST_F(TransactionParticipantRetryableWritesTest, TransactionTableUpdatesReplaceEntireDocument) {
@@ -349,7 +349,7 @@ TEST_F(TransactionParticipantRetryableWritesTest, StartingOldTxnShouldAssert) {
ASSERT_THROWS_CODE(txnParticipant->beginOrContinue(txnNum - 1, boost::none, boost::none),
AssertionException,
ErrorCodes::TransactionTooOld);
- ASSERT(txnParticipant->getLastWriteOpTime(txnNum).isNull());
+ ASSERT(txnParticipant->getLastWriteOpTime().isNull());
}
TEST_F(TransactionParticipantRetryableWritesTest, SessionTransactionsCollectionNotDefaultCreated) {
@@ -464,31 +464,6 @@ DEATH_TEST_F(TransactionParticipantRetryableWritesTest,
opCtx(), txnNum, {0}, opTime, Date_t::now(), boost::none);
}
-TEST_F(TransactionParticipantRetryableWritesTest,
- WriteOpCompletedOnPrimaryCommitIgnoresInvalidation) {
- const auto txnParticipant = TransactionParticipant::get(opCtx());
- txnParticipant->refreshFromStorageIfNeeded();
-
- const TxnNumber txnNum = 100;
- txnParticipant->beginOrContinue(txnNum, boost::none, boost::none);
-
- {
- AutoGetCollection autoColl(opCtx(), kNss, MODE_IX);
- WriteUnitOfWork wuow(opCtx());
- const auto uuid = UUID::gen();
- const auto opTime = logOp(opCtx(), kNss, uuid, *opCtx()->getLogicalSessionId(), txnNum, 0);
- txnParticipant->onWriteOpCompletedOnPrimary(
- opCtx(), txnNum, {0}, opTime, Date_t::now(), boost::none);
-
- txnParticipant->invalidate();
-
- wuow.commit();
- }
-
- txnParticipant->refreshFromStorageIfNeeded();
- ASSERT(txnParticipant->checkStatementExecuted(0));
-}
-
TEST_F(TransactionParticipantRetryableWritesTest, IncompleteHistoryDueToOpLogTruncation) {
const auto sessionId = *opCtx()->getLogicalSessionId();
const TxnNumber txnNum = 2;