diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2015-06-11 09:40:14 -0400 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2015-06-11 09:40:14 -0400 |
commit | 37f58ed85dc2ad27bac876ec4f2802d8f248b91d (patch) | |
tree | cc1685aa6005475a9d21c73822edf2b0e9fcc901 /jstests/concurrency | |
parent | 4035cab6b974613af9eb06ac1a92cc39d6ba8e06 (diff) | |
download | mongo-37f58ed85dc2ad27bac876ec4f2802d8f248b91d.tar.gz |
SERVER-18810 FSM support multiple mongos connections, alternating per workload thread.
Diffstat (limited to 'jstests/concurrency')
-rw-r--r-- | jstests/concurrency/fsm_libs/cluster.js | 9 | ||||
-rw-r--r-- | jstests/concurrency/fsm_libs/runner.js | 2 | ||||
-rw-r--r-- | jstests/concurrency/fsm_libs/thread_mgr.js | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/jstests/concurrency/fsm_libs/cluster.js b/jstests/concurrency/fsm_libs/cluster.js index 52f46699993..9e7f18eb2ab 100644 --- a/jstests/concurrency/fsm_libs/cluster.js +++ b/jstests/concurrency/fsm_libs/cluster.js @@ -63,6 +63,7 @@ var Cluster = function(options) { mongos: [], mongod: [] }; + var nextConn = 0; validateClusterOptions(options); Object.freeze(options); @@ -75,10 +76,10 @@ var Cluster = function(options) { } if (options.sharded) { - // TODO: allow 'options' to specify the number of shards + // TODO: allow 'options' to specify the number of shards and mongos processes var shardConfig = { shards: 2, - mongos: 1, + mongos: 2, verbose: verbosityLevel }; @@ -234,6 +235,10 @@ var Cluster = function(options) { throw new Error('cluster has not been initialized yet'); } + // Alternate mongos connections for sharded clusters + if (this.isSharded()) { + return _conns.mongos[nextConn++ % _conns.mongos.length].host; + } return conn.host; }; diff --git a/jstests/concurrency/fsm_libs/runner.js b/jstests/concurrency/fsm_libs/runner.js index 5e417ba6d9e..8df72679773 100644 --- a/jstests/concurrency/fsm_libs/runner.js +++ b/jstests/concurrency/fsm_libs/runner.js @@ -360,7 +360,7 @@ var runner = (function() { startTime = new Date(); threadMgr.init(workloads, context, maxAllowedConnections); - threadMgr.spawnAll(cluster.getHost(), executionOptions); + threadMgr.spawnAll(cluster, executionOptions); threadMgr.checkFailed(0.2); errors = threadMgr.joinAll(); diff --git a/jstests/concurrency/fsm_libs/thread_mgr.js b/jstests/concurrency/fsm_libs/thread_mgr.js index 03e5607ed2c..93c15efffd0 100644 --- a/jstests/concurrency/fsm_libs/thread_mgr.js +++ b/jstests/concurrency/fsm_libs/thread_mgr.js @@ -87,7 +87,7 @@ var ThreadManager = function(clusterOptions, executionMode) { initialized = true; }; - this.spawnAll = function spawnAll(host, options) { + this.spawnAll = function spawnAll(cluster, options) { if (!initialized) { throw new Error('thread manager has not been initialized yet'); } @@ -110,7 +110,7 @@ var ThreadManager = function(clusterOptions, executionMode) { var args = { tid: tid++, data: workloadData, - host: host, + host: cluster.getHost(), latch: latch, dbName: _context[workload].dbName, collName: _context[workload].collName, |