diff options
Diffstat (limited to 'jstests/concurrency/fsm_workloads/yield_id_hack.js')
-rw-r--r-- | jstests/concurrency/fsm_workloads/yield_id_hack.js | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/jstests/concurrency/fsm_workloads/yield_id_hack.js b/jstests/concurrency/fsm_workloads/yield_id_hack.js index 0d50eb7d350..eddb653c1d8 100644 --- a/jstests/concurrency/fsm_workloads/yield_id_hack.js +++ b/jstests/concurrency/fsm_workloads/yield_id_hack.js @@ -9,26 +9,25 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/yield.js'); // for $config -var $config = extendWorkload($config, - function($config, $super) { +var $config = extendWorkload($config, function($config, $super) { - /* - * Issue a query that will use the ID_HACK stage. This cannot be - * batched, so issue a - * number of them to increase the chances of yielding between - * getting the key and looking - * up its value. - */ - $config.states.query = function idHack(db, collName) { - var nQueries = 100; - for (var i = 0; i < nQueries; i++) { - assertAlways.lte(db[collName].find({_id: i}).itcount(), 1); - var res = db[collName].findOne({_id: i}); - if (res !== null) { - assertAlways.eq(i, res._id); - } - } - }; + /* + * Issue a query that will use the ID_HACK stage. This cannot be + * batched, so issue a + * number of them to increase the chances of yielding between + * getting the key and looking + * up its value. + */ + $config.states.query = function idHack(db, collName) { + var nQueries = 100; + for (var i = 0; i < nQueries; i++) { + assertAlways.lte(db[collName].find({_id: i}).itcount(), 1); + var res = db[collName].findOne({_id: i}); + if (res !== null) { + assertAlways.eq(i, res._id); + } + } + }; - return $config; - }); + return $config; +}); |