diff options
author | Matthew Russotto <matthew.russotto@10gen.com> | 2019-04-08 20:00:32 -0400 |
---|---|---|
committer | Matthew Russotto <matthew.russotto@10gen.com> | 2019-04-08 20:00:39 -0400 |
commit | b0d0de6a13a05c64e9e26392448e68303ccd69d5 (patch) | |
tree | 4dbe8249b06a907e9ea60235fcb867e978d244c9 /jstests/replsets/recovery_preserves_active_txns.js | |
parent | 07bcfd825c6ad2c347329af1a1b7634029048871 (diff) | |
download | mongo-b0d0de6a13a05c64e9e26392448e68303ccd69d5.tar.gz |
SERVER-39790 Reconstruct prepared transactions from new oplog format on startup
Diffstat (limited to 'jstests/replsets/recovery_preserves_active_txns.js')
-rw-r--r-- | jstests/replsets/recovery_preserves_active_txns.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/jstests/replsets/recovery_preserves_active_txns.js b/jstests/replsets/recovery_preserves_active_txns.js index 36ff0b80db2..dbaec94bfc2 100644 --- a/jstests/replsets/recovery_preserves_active_txns.js +++ b/jstests/replsets/recovery_preserves_active_txns.js @@ -15,6 +15,14 @@ load("jstests/core/txns/libs/prepare_helpers.js"); load("jstests/libs/check_log.js"); + function findPrepareEntry(oplogColl) { + if (TestData.setParameters.useMultipleOplogEntryFormatForTransactions) { + return oplogColl.findOne({op: "c", o: {"prepareTransaction": 1}}); + } else { + return oplogColl.findOne({prepare: true}); + } + } + // A new replica set for both the commit and abort tests to ensure the same clean state. function doTest(commitOrAbort) { const replSet = new ReplSetTest({ @@ -52,7 +60,7 @@ assert.soon(() => { return secondaryOplog.dataSize() >= PrepareHelpers.oplogSizeBytes; }, "waiting for secondary oplog to grow", ReplSetTest.kDefaultTimeoutMS); - const secondaryOplogEntry = secondaryOplog.findOne({prepare: true}); + const secondaryOplogEntry = findPrepareEntry(secondaryOplog); assert.eq(secondaryOplogEntry.ts, prepareTimestamp, tojson(secondaryOplogEntry)); } checkSecondaryOplog(); |