diff options
author | Jason Zhang <jason.zhang@mongodb.com> | 2022-08-25 17:23:20 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-31 15:14:00 +0000 |
commit | a58b2debd6e56a9fac2fc0c22f7f82e78e9af6cd (patch) | |
tree | 0731b6a21d28a0ed7b018a3a8ebdc06f82762036 | |
parent | eb45396105c9c4fac61ceacbc890336083dcd471 (diff) | |
download | mongo-a58b2debd6e56a9fac2fc0c22f7f82e78e9af6cd.tar.gz |
SERVER-69118 Have retryable findAndModify failover internal transaction test wait until lastCommittedOpTime is recovered after failover
(cherry picked from commit cabbf002eeccb81bc696a3677c2f1d5436d09eef)
-rw-r--r-- | jstests/sharding/internal_txns/retryable_findAndModify_commit_and_abort_prepared_txns_after_failover_and_restart.js | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/jstests/sharding/internal_txns/retryable_findAndModify_commit_and_abort_prepared_txns_after_failover_and_restart.js b/jstests/sharding/internal_txns/retryable_findAndModify_commit_and_abort_prepared_txns_after_failover_and_restart.js index f96f17b9fb9..bfade15b54a 100644 --- a/jstests/sharding/internal_txns/retryable_findAndModify_commit_and_abort_prepared_txns_after_failover_and_restart.js +++ b/jstests/sharding/internal_txns/retryable_findAndModify_commit_and_abort_prepared_txns_after_failover_and_restart.js @@ -67,12 +67,6 @@ function runTest(st, stepDownShard0PrimaryFunc, testOpts = { const prepareTxnRes = assert.commandWorked(testDB.adminCommand(prepareCmdObj)); commitCmdObj.commitTimestamp = prepareTxnRes.prepareTimestamp; - // It is possible that a secondary that steps up could use a stale majority-committed snapshot, - // so we want to wait until the prepareTransaction is visible in the majority-committed snapshot - // view for all nodes in the replica set. We do this because commitTransaction for a prepared - // transaction cannot be run before its prepare oplog entry has been majority committed - st.rs0.awaitLastOpCommitted(); - stepDownShard0PrimaryFunc(); testDB = st.rs0.getPrimary().getDB(kDbName); @@ -174,9 +168,9 @@ function runTest(st, stepDownShard0PrimaryFunc, testOpts = { st.rs0.stopSet(null /* signal */, true /*forRestart */); st.rs0.startSet({restart: true}); st.rs0.getPrimary(); - // Wait for replication since it is illegal to run commitTransaction before the prepare - // oplog entry has been majority committed. - st.rs0.awaitReplication(); + // Wait for replication to recover the lastCommittedOpTime since it is illegal to run + // commitTransaction before the prepare oplog entry has been majority committed. + st.rs0.awaitLastOpCommitted(); }; // Test findAnModify without pre/post image. |