diff options
Diffstat (limited to 'jstests/concurrency/fsm_workloads/yield_id_hack.js')
-rw-r--r-- | jstests/concurrency/fsm_workloads/yield_id_hack.js | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/jstests/concurrency/fsm_workloads/yield_id_hack.js b/jstests/concurrency/fsm_workloads/yield_id_hack.js index ef43bbed49b..81a5acbb0fd 100644 --- a/jstests/concurrency/fsm_workloads/yield_id_hack.js +++ b/jstests/concurrency/fsm_workloads/yield_id_hack.js @@ -6,26 +6,29 @@ * Intersperse queries which use the ID_HACK stage with updates and deletes of documents they may * match. */ -load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload -load('jstests/concurrency/fsm_workloads/yield.js'); // for $config +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; + }); |