blob: 47ad30cedab3e1c6b10e07ef1fb46cb4d99f0a46 (
plain)
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
|
'use strict';
/**
* compact_simultaneous_padding_bytes.js
*
* Bulk inserts 1000 documents and builds indexes. Then alternates between compacting the
* collection and verifying the number of documents and indexes. Operates on a single collection
* for all threads. Uses paddingBytes as a parameter for compact.
*/
load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
load('jstests/concurrency/fsm_workloads/compact.js'); // for $config
load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isEphemeral
var $config = extendWorkload(
$config,
function($config, $super) {
$config.states.init = function init(db, collName) {
this.threadCollName = collName;
};
$config.states.compact = function compact(db, collName) {
var res =
db.runCommand({compact: this.threadCollName, paddingBytes: 1024 * 5, force: true});
if (!isEphemeral(db)) {
assertAlways.commandWorked(res);
} else {
assertAlways.commandFailedWithCode(res, ErrorCodes.CommandNotSupported);
}
};
// no-op the query state because querying while compacting can result in closed cursors
// as per SERVER-3964, as well as inaccurate counts, leaving nothing to assert.
$config.states.query = function query(db, collName) {};
return $config;
});
|