0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-44373: recover_multiple_prepared_transactions_startup.js test should wait for majority commit point to advance before committing a prepared transaction

This commit is contained in:
Lingzhi Deng 2019-11-01 21:34:41 +00:00 committed by evergreen
parent fbb940bd7f
commit 8191b9a55d

View File

@ -101,7 +101,12 @@ assert.commandFailedWithCode(sessionDB.runCommand({
ErrorCodes.PreparedTransactionInProgress);
jsTestLog("Committing the first transaction");
// Wait for the prepared transaction oplog entry to be majority committed before committing the
// transaction. This is needed after restarting the node in a single-node replica set because the
// lastCommitted is not set until it flushes its first oplog entry after the restart. We need to
// wait for the lastCommitted OpTime to be past the prepareTimestamp before committing the prepared
// transaction.
PrepareHelpers.awaitMajorityCommitted(replTest, prepareTimestamp);
// Make sure we can successfully commit the first transaction after recovery.
let commitTimestamp = Timestamp(prepareTimestamp.getTime(), prepareTimestamp.getInc() + 1);
assert.commandWorked(sessionDB.adminCommand({