From b0d0de6a13a05c64e9e26392448e68303ccd69d5 Mon Sep 17 00:00:00 2001 From: Matthew Russotto Date: Mon, 8 Apr 2019 20:00:32 -0400 Subject: SERVER-39790 Reconstruct prepared transactions from new oplog format on startup --- jstests/replsets/recovery_preserves_active_txns.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'jstests/replsets/recovery_preserves_active_txns.js') 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(); -- cgit v1.2.1