summaryrefslogtreecommitdiff
path: root/jstests/concurrency/fsm_workloads/remove_where.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/concurrency/fsm_workloads/remove_where.js')
-rw-r--r--jstests/concurrency/fsm_workloads/remove_where.js57
1 files changed, 31 insertions, 26 deletions
diff --git a/jstests/concurrency/fsm_workloads/remove_where.js b/jstests/concurrency/fsm_workloads/remove_where.js
index ecfbe722db8..0ef4f3d9931 100644
--- a/jstests/concurrency/fsm_workloads/remove_where.js
+++ b/jstests/concurrency/fsm_workloads/remove_where.js
@@ -8,35 +8,40 @@
* counts.
*/
-load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
-load('jstests/concurrency/fsm_workloads/indexed_insert_where.js'); // for $config
+load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
+load('jstests/concurrency/fsm_workloads/indexed_insert_where.js'); // for $config
-var $config = extendWorkload($config, function($config, $super) {
- $config.data.randomBound = 10;
- $config.data.generateDocumentToInsert = function generateDocumentToInsert() {
- return { tid: this.tid, x: Random.randInt(this.randomBound) };
- };
+var $config = extendWorkload(
+ $config,
+ function($config, $super) {
+ $config.data.randomBound = 10;
+ $config.data.generateDocumentToInsert = function generateDocumentToInsert() {
+ return {
+ tid: this.tid,
+ x: Random.randInt(this.randomBound)
+ };
+ };
- $config.states.remove = function remove(db, collName) {
- var res = db[collName].remove({
- // Server-side JS does not support Random.randInt, so use Math.floor/random instead
- $where: 'this.x === Math.floor(Math.random() * ' + this.randomBound + ') ' +
+ $config.states.remove = function remove(db, collName) {
+ var res = db[collName].remove({
+ // Server-side JS does not support Random.randInt, so use Math.floor/random instead
+ $where: 'this.x === Math.floor(Math.random() * ' + this.randomBound + ') ' +
'&& this.tid === ' + this.tid
- });
- assertWhenOwnColl.gte(res.nRemoved, 0);
- assertWhenOwnColl.lte(res.nRemoved, this.insertedDocuments);
- this.insertedDocuments -= res.nRemoved;
- };
+ });
+ assertWhenOwnColl.gte(res.nRemoved, 0);
+ assertWhenOwnColl.lte(res.nRemoved, this.insertedDocuments);
+ this.insertedDocuments -= res.nRemoved;
+ };
- $config.transitions = {
- insert: { insert: 0.2, remove: 0.4, query: 0.4 },
- remove: { insert: 0.4, remove: 0.2, query: 0.4 },
- query: { insert: 0.4, remove: 0.4, query: 0.2 }
- };
+ $config.transitions = {
+ insert: {insert: 0.2, remove: 0.4, query: 0.4},
+ remove: {insert: 0.4, remove: 0.2, query: 0.4},
+ query: {insert: 0.4, remove: 0.4, query: 0.2}
+ };
- $config.setup = function setup(db, collName, cluster) {
- /* no-op to prevent index from being created */
- };
+ $config.setup = function setup(db, collName, cluster) {
+ /* no-op to prevent index from being created */
+ };
- return $config;
-});
+ return $config;
+ });