summaryrefslogtreecommitdiff
path: root/jstests/replsets/apply_prepare_txn_write_conflict_robustness.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/apply_prepare_txn_write_conflict_robustness.js')
-rw-r--r--jstests/replsets/apply_prepare_txn_write_conflict_robustness.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/jstests/replsets/apply_prepare_txn_write_conflict_robustness.js b/jstests/replsets/apply_prepare_txn_write_conflict_robustness.js
index 330ebfed751..62e98879d48 100644
--- a/jstests/replsets/apply_prepare_txn_write_conflict_robustness.js
+++ b/jstests/replsets/apply_prepare_txn_write_conflict_robustness.js
@@ -22,7 +22,8 @@ const primaryDB = primary.getDB(dbName);
const primaryColl = primaryDB[collName];
jsTestLog("Do a document write");
-assert.commandWorked(primaryColl.insert({_id: 0}, {"writeConcern": {"w": "majority"}}));
+assert.commandWorked(
+        primaryColl.insert({_id: 0}, {"writeConcern": {"w": "majority"}}));
// Enable fail point on secondary to cause apply prepare transaction oplog entry's ops to fail
// with write conflict error at least once.
@@ -36,21 +37,15 @@ const sessionColl = sessionDB.getCollection(collName);
session.startTransaction({writeConcern: {w: "majority"}});
assert.commandWorked(sessionColl.insert({_id: 1}));
-const status1 = secondary.adminCommand({serverStatus: 1});
-
// PrepareTransaction cmd will be successful only if secondary is able to retry applying
// prepareTransaction oplog entry on WT_ROLLBACK (WriteConflictException) error.
jsTestLog("Prepare transaction");
let prepareTimestamp = PrepareHelpers.prepareTransaction(session);
-// Verify that the writeConflicts metrics in serverStatus is incremented on secondary.
-const status2 = secondary.adminCommand({serverStatus: 1});
-assert.gt(status2.metrics.operation.writeConflicts, status1.metrics.operation.writeConflicts);
-
jsTestLog("Commit transaction");
assert.commandWorked(PrepareHelpers.commitTransaction(session, prepareTimestamp));
-// Verify that the committed transaction data is present on secondary.
+// Verify that the committed transaction data is present on secondary.
assert.eq(secondary.getDB(dbName)[collName].findOne({_id: 1}), {_id: 1});
// verify that secondaries are not holding any transactional lock resources.