diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2021-03-16 15:26:22 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-16 20:02:29 +0000 |
commit | 133d07b3e9e8dfb2aacb52dc2174bee38d791aec (patch) | |
tree | b9534e2e7722ae853d1bac90ad82b2c11104e0c1 /src/mongo/db/s/session_catalog_migration_source_test.cpp | |
parent | f7a7901fc4b02e843cb23285ed28d08f14097ca7 (diff) | |
download | mongo-133d07b3e9e8dfb2aacb52dc2174bee38d791aec.tar.gz |
SERVER-55194 Allow multiple statement ids per oplog entry
Diffstat (limited to 'src/mongo/db/s/session_catalog_migration_source_test.cpp')
-rw-r--r-- | src/mongo/db/s/session_catalog_migration_source_test.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/mongo/db/s/session_catalog_migration_source_test.cpp b/src/mongo/db/s/session_catalog_migration_source_test.cpp index 349dfac2015..46881036634 100644 --- a/src/mongo/db/s/session_catalog_migration_source_test.cpp +++ b/src/mongo/db/s/session_catalog_migration_source_test.cpp @@ -60,7 +60,7 @@ repl::OplogEntry makeOplogEntry(repl::OpTime opTime, BSONObj object, boost::optional<BSONObj> object2, Date_t wallClockTime, - StmtId stmtId, + const std::vector<StmtId>& stmtIds, repl::OpTime prevWriteOpTimeInTransaction, boost::optional<repl::OpTime> preImageOpTime, boost::optional<repl::OpTime> postImageOpTime) { @@ -77,7 +77,7 @@ repl::OplogEntry makeOplogEntry(repl::OpTime opTime, {}, // sessionInfo boost::none, // upsert wallClockTime, // wall clock time - stmtId, // statement id + stmtIds, // statement ids prevWriteOpTimeInTransaction, // optime of previous write within same transaction preImageOpTime, // pre-image optime postImageOpTime, // post-image optime @@ -90,7 +90,7 @@ repl::OplogEntry makeOplogEntry(repl::OpTime opTime, BSONObj object, boost::optional<BSONObj> object2, Date_t wallClockTime, - StmtId stmtId, + const std::vector<StmtId>& stmtIds, repl::OpTime prevWriteOpTimeInTransaction, boost::optional<repl::OpTime> preImageOpTime = boost::none, boost::optional<repl::OpTime> postImageOpTime = boost::none) { @@ -100,7 +100,7 @@ repl::OplogEntry makeOplogEntry(repl::OpTime opTime, object, object2, wallClockTime, - stmtId, + stmtIds, prevWriteOpTimeInTransaction, preImageOpTime, postImageOpTime); @@ -119,7 +119,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithTwoWrites) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -129,7 +129,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithTwoWrites) { BSON("x" << 50), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids entry1.getOpTime()); // optime of previous write within same transaction insertOplogEntry(entry2); @@ -173,7 +173,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWrites) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction auto entry1b = @@ -182,7 +182,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWrites) { BSON("x" << 50), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids entry1a.getOpTime()); // optime of previous write within same transaction SessionTxnRecord sessionRecord1; @@ -201,7 +201,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWrites) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 3, // statement id + {3}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction auto entry2b = @@ -210,7 +210,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWrites) { BSON("x" << 50), // o boost::none, // o2 Date_t::now(), // wall clock time - 4, // statement id + {4}, // statement ids entry2a.getOpTime()); // optime of previous write within same transaction SessionTxnRecord sessionRecord2; @@ -279,7 +279,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithFindAndModifyPreImageAnd BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -289,7 +289,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithFindAndModifyPreImageAnd BSON("x" << 50), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0), // optime of previous write within same transaction entry1.getOpTime()); // pre-image optime insertOplogEntry(entry2); @@ -300,7 +300,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithFindAndModifyPreImageAnd BSON("x" << 20), // o boost::none, // o2 Date_t::now(), // wall clock time - 2, // statement id + {2}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry3); @@ -310,7 +310,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithFindAndModifyPreImageAnd BSON("$inc" << BSON("x" << 1)), // o BSON("x" << 19), // o2 Date_t::now(), // wall clock time - 3, // statement id + {3}, // statement ids entry2.getOpTime(), // optime of previous write within same transaction boost::none, // pre-image optime entry3.getOpTime()); // post-image optime @@ -349,7 +349,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OplogWithOtherNsShouldBeIgnored) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -371,7 +371,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OplogWithOtherNsShouldBeIgnored) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0), // optime of previous write within same transaction boost::none, // pre-image optime boost::none); // post-image optime @@ -406,7 +406,7 @@ TEST_F(SessionCatalogMigrationSourceTest, SessionDumpWithMultipleNewWrites) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -427,7 +427,7 @@ TEST_F(SessionCatalogMigrationSourceTest, SessionDumpWithMultipleNewWrites) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry2); @@ -437,7 +437,7 @@ TEST_F(SessionCatalogMigrationSourceTest, SessionDumpWithMultipleNewWrites) { BSON("x" << 40), // o boost::none, // o2 Date_t::now(), // wall clock time - 2, // statement id + {2}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry3); @@ -499,7 +499,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ShouldBeAbleInsertNewWritesAfterBuffer BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry); @@ -524,7 +524,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ShouldBeAbleInsertNewWritesAfterBuffer BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry); @@ -548,7 +548,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ShouldBeAbleInsertNewWritesAfterBuffer BSON("x" << 40), // o boost::none, // o2 Date_t::now(), // wall clock time - 2, // statement id + {2}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry); @@ -573,7 +573,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ReturnsDeadEndSentinelForIncompleteHis BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(40, 1), 2)); // optime of previous write within same transaction insertOplogEntry(entry); @@ -608,8 +608,8 @@ TEST_F(SessionCatalogMigrationSourceTest, ReturnsDeadEndSentinelForIncompleteHis auto oplog = *nextOplogResult.oplog; ASSERT_TRUE(oplog.getObject2()); ASSERT_BSONOBJ_EQ(TransactionParticipant::kDeadEndSentinel, *oplog.getObject2()); - ASSERT_TRUE(oplog.getStatementId()); - ASSERT_EQ(kIncompleteHistoryStmtId, *oplog.getStatementId()); + ASSERT_EQ(1, oplog.getStatementIds().size()); + ASSERT_EQ(kIncompleteHistoryStmtId, oplog.getStatementIds().front()); ASSERT_NE(Date_t{}, oplog.getWallClockTime()); auto sessionInfo = oplog.getOperationSessionInfo(); @@ -630,7 +630,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ShouldAssertWhenRollbackDetected) { BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(40, 1), 2)); // optime of previous write within same transaction insertOplogEntry(entry); @@ -757,7 +757,7 @@ TEST_F(SessionCatalogMigrationSourceTest, BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction // Create a config.transaction entry pointing to the insert oplog entry. @@ -832,7 +832,7 @@ TEST_F(SessionCatalogMigrationSourceTest, FindAndModifyDeleteNotTouchingChunkIsI BSON("x" << -50), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -842,7 +842,7 @@ TEST_F(SessionCatalogMigrationSourceTest, FindAndModifyDeleteNotTouchingChunkIsI BSON("x" << -50), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0), // optime of previous write within same transaction entry1.getOpTime()); // pre-image optime insertOplogEntry(entry2); @@ -867,7 +867,7 @@ TEST_F(SessionCatalogMigrationSourceTest, FindAndModifyUpdatePrePostNotTouchingC BSON("x" << -5), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -877,7 +877,7 @@ TEST_F(SessionCatalogMigrationSourceTest, FindAndModifyUpdatePrePostNotTouchingC BSON("$set" << BSON("y" << 1)), // o BSON("x" << -5), // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0), // optime of previous write within same transaction entry1.getOpTime()); // pre-image optime insertOplogEntry(entry2); @@ -903,7 +903,7 @@ TEST_F(SessionCatalogMigrationSourceTest, BSON("x" << -50), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -913,7 +913,7 @@ TEST_F(SessionCatalogMigrationSourceTest, BSON("$set" << BSON("x" << -50)), // o BSON("x" << 10), // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0), // optime of previous write within same transaction boost::none, // pre-image optime entry1.getOpTime()); // post-image optime @@ -953,7 +953,7 @@ TEST_F(SessionCatalogMigrationSourceTest, BSON("x" << 50), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -963,7 +963,7 @@ TEST_F(SessionCatalogMigrationSourceTest, BSON("$set" << BSON("x" << 50)), // o BSON("x" << -10), // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0), // optime of previous write within same transaction boost::none, // pre-image optime entry1.getOpTime()); // post-image optime @@ -989,7 +989,7 @@ TEST_F(SessionCatalogMigrationSourceTest, FindAndModifyUpdateNotTouchingChunkSho BSON("x" << -10 << "y" << 50), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry1); @@ -999,7 +999,7 @@ TEST_F(SessionCatalogMigrationSourceTest, FindAndModifyUpdateNotTouchingChunkSho BSON("$set" << BSON("y" << 50)), // o BSON("x" << -10), // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids repl::OpTime(Timestamp(0, 0), 0), // optime of previous write within same transaction boost::none, // pre-image optime entry1.getOpTime()); // post-image optime @@ -1032,7 +1032,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWritesContainingWrite BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 0, // statement id + {0}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction auto entry1b = @@ -1041,7 +1041,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWritesContainingWrite BSON("x" << -50), // o boost::none, // o2 Date_t::now(), // wall clock time - 1, // statement id + {1}, // statement ids entry1a.getOpTime()); // optime of previous write within same transaction SessionTxnRecord sessionRecord1; @@ -1060,7 +1060,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWritesContainingWrite BSON("x" << 30), // o boost::none, // o2 Date_t::now(), // wall clock time - 3, // statement id + {3}, // statement ids repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction auto entry2b = @@ -1069,7 +1069,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWritesContainingWrite BSON("x" << 50), // o boost::none, // o2 Date_t::now(), // wall clock time - 4, // statement id + {4}, // statement ids entry2a.getOpTime()); // optime of previous write within same transaction SessionTxnRecord sessionRecord2; |