summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorJudah Schvimer <judah.schvimer@10gen.com>2019-09-11 20:43:17 +0000
committerevergreen <evergreen@mongodb.com>2019-09-11 20:43:17 +0000
commit1659ddcfb49050dcf18fef014cd9d5ebf5717650 (patch)
tree98cabdca5f17b8a9bce0de1456ff2d4f57d2c790 /jstests
parentaea85d0f2c87c0ad9eb1ff13e1063ae3e6cf2eb2 (diff)
downloadmongo-1659ddcfb49050dcf18fef014cd9d5ebf5717650.tar.gz
SERVER-42987 make it safe to interrupt abortTransaction
Diffstat (limited to 'jstests')
-rw-r--r--jstests/replsets/kill_prepared_transaction_commit_abort.js22
1 files changed, 6 insertions, 16 deletions
diff --git a/jstests/replsets/kill_prepared_transaction_commit_abort.js b/jstests/replsets/kill_prepared_transaction_commit_abort.js
index 58a964a2bf8..280cbdc9191 100644
--- a/jstests/replsets/kill_prepared_transaction_commit_abort.js
+++ b/jstests/replsets/kill_prepared_transaction_commit_abort.js
@@ -6,10 +6,6 @@
(function() {
"use strict";
-// TODO (SERVER-42987) Re-enable this test.
-if (true) {
- return;
-}
load("jstests/core/txns/libs/prepare_helpers.js");
load("jstests/libs/parallelTester.js"); // for ScopedThread.
@@ -51,11 +47,10 @@ function killOpThread(host, dbName, collName, shutdownLatch) {
]
};
let ops = nodeDB.currentOp(filter).inprog;
- if (ops.length > 0) {
- print("Going to run 'killOp' on " + ops.length + " ops.");
- }
ops.forEach(op => {
- if (op.opid) {
+ // Let some operations survive so the test terminates.
+ const shouldKill = (Math.random() < 0.8);
+ if (op.opid && shouldKill) {
nodeDB.killOp(op.opid);
}
});
@@ -125,14 +120,6 @@ function commitOrAbortAllTransactions(sessions) {
// The number of sessions and transactions to create.
const numTxns = 100;
-// Make the server sleep a bit right after commit/abort commands start to make it more likely that
-// the kill op thread will be able to find and kill them.
-assert.commandWorked(primary.adminCommand({
- configureFailPoint: "sleepMillisAfterCommandExecutionBegins",
- mode: "alwaysOn",
- data: {millis: 50, commands: {"commitTransaction": 1, "abortTransaction": 1}}
-}));
-
jsTestLog("Creating sessions and preparing " + numTxns + " transactions.");
let sessions = createPreparedTransactions(numTxns);
@@ -140,6 +127,9 @@ jsTestLog("Starting the killOp thread.");
let killThread = new Thread(killOpThread, primary.host, dbName, collName, shutdownLatch);
killThread.start();
+// Sleep for a second to let the killThread begin killing.
+sleep(1000);
+
jsTestLog("Committing/aborting all transactions.");
commitOrAbortAllTransactions(sessions);