summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2018-10-08 13:15:30 -0400
committerjannaerin <golden.janna@gmail.com>2018-10-09 16:51:46 -0400
commitf862975d40d5cb8d848892dfa6990994ae586e4b (patch)
tree6c555da0f16a05c40ece3a50e19211bd89167b98 /jstests
parent627d6027b15b2355cb9621dd28cce4b7024fbf9c (diff)
downloadmongo-f862975d40d5cb8d848892dfa6990994ae586e4b.tar.gz
SERVER-37374 cleanupOnLastIteration should tolerate an interruption
Diffstat (limited to 'jstests')
-rw-r--r--jstests/concurrency/fsm_workload_helpers/cleanup_txns.js8
-rw-r--r--jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js7
-rw-r--r--jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js8
3 files changed, 14 insertions, 9 deletions
diff --git a/jstests/concurrency/fsm_workload_helpers/cleanup_txns.js b/jstests/concurrency/fsm_workload_helpers/cleanup_txns.js
index 098907f2cb3..733724dfbfe 100644
--- a/jstests/concurrency/fsm_workload_helpers/cleanup_txns.js
+++ b/jstests/concurrency/fsm_workload_helpers/cleanup_txns.js
@@ -15,13 +15,7 @@ function abortTransaction(db, txnNumber, errorCodes) {
* This function operates on the last iteration of each thread to abort any active transactions.
*/
var {cleanupOnLastIteration} = (function() {
- function cleanupOnLastIteration(data, func) {
- const abortErrorCodes = [
- ErrorCodes.NoSuchTransaction,
- ErrorCodes.TransactionCommitted,
- ErrorCodes.TransactionTooOld
- ];
-
+ function cleanupOnLastIteration(data, func, abortErrorCodes) {
let lastIteration = ++data.iteration >= data.iterations;
try {
func();
diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js
index 44aa8d81dbd..911403c6be2 100644
--- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js
+++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js
@@ -155,8 +155,13 @@ var $config = (function() {
// Wrap each state in a cleanupOnLastIteration() invocation.
for (let stateName of Object.keys(states)) {
const stateFn = states[stateName];
+ const abortErrorCodes = [
+ ErrorCodes.NoSuchTransaction,
+ ErrorCodes.TransactionCommitted,
+ ErrorCodes.TransactionTooOld
+ ];
states[stateName] = function(db, collName) {
- cleanupOnLastIteration(this, () => stateFn.apply(this, arguments));
+ cleanupOnLastIteration(this, () => stateFn.apply(this, arguments), abortErrorCodes);
};
}
diff --git a/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js b/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js
index 34b28f15d63..de2ca10cd31 100644
--- a/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js
+++ b/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js
@@ -95,8 +95,14 @@ var $config = (function() {
// Wrap each state in a cleanupOnLastIteration() invocation.
for (let stateName of Object.keys(states)) {
const stateFn = states[stateName];
+ const abortErrorCodes = [
+ ErrorCodes.NoSuchTransaction,
+ ErrorCodes.TransactionCommitted,
+ ErrorCodes.TransactionTooOld,
+ ErrorCodes.Interrupted
+ ];
states[stateName] = function(db, collName) {
- cleanupOnLastIteration(this, () => stateFn.apply(this, arguments));
+ cleanupOnLastIteration(this, () => stateFn.apply(this, arguments), abortErrorCodes);
};
}