diff options
Diffstat (limited to 'jstests/concurrency/fsm_workloads/map_reduce_merge.js')
-rw-r--r-- | jstests/concurrency/fsm_workloads/map_reduce_merge.js | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/jstests/concurrency/fsm_workloads/map_reduce_merge.js b/jstests/concurrency/fsm_workloads/map_reduce_merge.js index 7f83a924bce..fd892dc72d9 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_merge.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_merge.js @@ -13,53 +13,52 @@ * * Writes the results of each thread to the same collection. */ -load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload -load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config +load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload +load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config -var $config = extendWorkload($config, function($config, $super) { +var $config = + extendWorkload($config, + function($config, $super) { - // Use the workload name as the database name, - // since the workload name is assumed to be unique. - var uniqueDBName = 'map_reduce_merge'; + // Use the workload name as the database name, + // since the workload name is assumed to be unique. + var uniqueDBName = 'map_reduce_merge'; - $config.states.init = function init(db, collName) { - $super.states.init.apply(this, arguments); + $config.states.init = function init(db, collName) { + $super.states.init.apply(this, arguments); - this.outDBName = db.getName() + uniqueDBName; - }; + this.outDBName = db.getName() + uniqueDBName; + }; - $config.states.mapReduce = function mapReduce(db, collName) { - var outDB = db.getSiblingDB(this.outDBName); - var fullName = outDB[collName].getFullName(); - assertAlways(outDB[collName].exists() !== null, - "output collection '" + fullName + "' should exist"); + $config.states.mapReduce = function mapReduce(db, collName) { + var outDB = db.getSiblingDB(this.outDBName); + var fullName = outDB[collName].getFullName(); + assertAlways(outDB[collName].exists() !== null, + "output collection '" + fullName + "' should exist"); - // Have all threads combine their results into the same collection - var options = { - finalize: this.finalizer, - out: { - merge: collName, - db: this.outDBName - } - }; + // Have all threads combine their results into the same collection + var options = { + finalize: this.finalizer, + out: {merge: collName, db: this.outDBName} + }; - var res = db[collName].mapReduce(this.mapper, this.reducer, options); - assertAlways.commandWorked(res); - }; + var res = db[collName].mapReduce(this.mapper, this.reducer, options); + assertAlways.commandWorked(res); + }; - $config.setup = function setup(db, collName, cluster) { - $super.setup.apply(this, arguments); + $config.setup = function setup(db, collName, cluster) { + $super.setup.apply(this, arguments); - var outDB = db.getSiblingDB(db.getName() + uniqueDBName); - assertAlways.commandWorked(outDB.createCollection(collName)); - }; + var outDB = db.getSiblingDB(db.getName() + uniqueDBName); + assertAlways.commandWorked(outDB.createCollection(collName)); + }; - $config.teardown = function teardown(db, collName, cluster) { - var outDB = db.getSiblingDB(db.getName() + uniqueDBName); - var res = outDB.dropDatabase(); - assertAlways.commandWorked(res); - assertAlways.eq(db.getName() + uniqueDBName, res.dropped); - }; + $config.teardown = function teardown(db, collName, cluster) { + var outDB = db.getSiblingDB(db.getName() + uniqueDBName); + var res = outDB.dropDatabase(); + assertAlways.commandWorked(res); + assertAlways.eq(db.getName() + uniqueDBName, res.dropped); + }; - return $config; -}); + return $config; + }); |