1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
'use strict';
/**
* remove_single_document_eval.js
*
* Runs remove_single_document using the eval command.
*/
load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
load('jstests/concurrency/fsm_workloads/remove_single_document.js'); // for $config
var $config =
extendWorkload($config,
function($config, $super) {
$config.data.doRemove = function doRemove(db, collName, query, options) {
var evalResult = db.runCommand({
eval: function(f, collName, query, options) {
return tojson(f(db, collName, query, options));
},
args: [$super.data.doRemove, collName, query, options],
nolock: this.nolock
});
assertAlways.commandWorked(evalResult);
var res = JSON.parse(evalResult.retval);
return res;
};
$config.data.assertResult = function assertResult(res) {
assertWhenOwnColl.eq(1, res.nRemoved, tojson(res));
};
$config.data.nolock = false;
// scale down threadCount and iterations because eval takes a global lock
$config.threadCount = 5;
$config.iterations = 10;
return $config;
});
|