summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2017-08-30 15:21:45 -0400
committerJack Mulrow <jack.mulrow@mongodb.com>2017-09-04 17:46:21 -0400
commite51c6a85d217454b39236bbe97bc62290960f5b2 (patch)
treeaeb373aaf3bc9cd59fec135e770bf24ecbe89e6a
parentc31e309846609b4309a72868db7eafc189f839ca (diff)
downloadmongo-e51c6a85d217454b39236bbe97bc62290960f5b2.tar.gz
SERVER-30680 Add support for session options to the concurrency framework
-rw-r--r--jstests/concurrency/fsm_libs/runner.js9
-rw-r--r--jstests/concurrency/fsm_libs/thread_mgr.js3
-rw-r--r--jstests/concurrency/fsm_libs/worker_thread.js9
3 files changed, 17 insertions, 4 deletions
diff --git a/jstests/concurrency/fsm_libs/runner.js b/jstests/concurrency/fsm_libs/runner.js
index ec629245dad..f620a0b46d9 100644
--- a/jstests/concurrency/fsm_libs/runner.js
+++ b/jstests/concurrency/fsm_libs/runner.js
@@ -42,8 +42,13 @@ var runner = (function() {
}
function validateExecutionOptions(mode, options) {
- var allowedKeys =
- ['backgroundWorkloads', 'dbNamePrefix', 'iterationMultiplier', 'threadMultiplier'];
+ var allowedKeys = [
+ 'backgroundWorkloads',
+ 'dbNamePrefix',
+ 'iterationMultiplier',
+ 'sessionOptions',
+ 'threadMultiplier'
+ ];
if (mode.parallel || mode.composed) {
allowedKeys.push('numSubsets');
diff --git a/jstests/concurrency/fsm_libs/thread_mgr.js b/jstests/concurrency/fsm_libs/thread_mgr.js
index 9680e22435b..32fc4f042d5 100644
--- a/jstests/concurrency/fsm_libs/thread_mgr.js
+++ b/jstests/concurrency/fsm_libs/thread_mgr.js
@@ -118,7 +118,8 @@ var ThreadManager = function(clusterOptions, executionMode = {composed: false})
clusterOptions: clusterOptions,
seed: Random.randInt(1e13), // contains range of Date.getTime()
globalAssertLevel: globalAssertLevel,
- errorLatch: errorLatch
+ errorLatch: errorLatch,
+ sessionOptions: options.sessionOptions
};
var t = makeThread(workloads, args, options);
diff --git a/jstests/concurrency/fsm_libs/worker_thread.js b/jstests/concurrency/fsm_libs/worker_thread.js
index 36063d5a7e5..44bdb870d0c 100644
--- a/jstests/concurrency/fsm_libs/worker_thread.js
+++ b/jstests/concurrency/fsm_libs/worker_thread.js
@@ -18,6 +18,7 @@ var workerThread = (function() {
// args.seed = seed for the random number generator
// args.globalAssertLevel = the global assertion level to use
// args.errorLatch = CountDownLatch instance that threads count down when they error
+ // args.sessionOptions = the options to start a session with
// run = callback that takes a map of workloads to their associated $config
function main(workloads, args, run) {
var myDB;
@@ -36,7 +37,13 @@ var workerThread = (function() {
gc();
}
- myDB = new Mongo(args.host).getDB(args.dbName);
+ if (typeof args.sessionOptions !== 'undefined') {
+ myDB = new Mongo(args.host)
+ .startSession(args.sessionOptions)
+ .getDatabase(args.dbName);
+ } else {
+ myDB = new Mongo(args.host).getDB(args.dbName);
+ }
}
if (Cluster.isReplication(args.clusterOptions)) {