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
40
41
42
43
44
45
46
47
48
|
'use strict';
/**
* create_collection.js
*
* Repeatedly creates a collection.
*/
var $config = (function() {
var data = {
// Use the workload name as a prefix for the collection name,
// since the workload name is assumed to be unique.
prefix: 'create_collection'
};
var states = (function() {
function uniqueCollectionName(prefix, tid, num) {
return prefix + tid + '_' + num;
}
function init(db, collName) {
this.num = 0;
}
// TODO: how to avoid having too many files open?
function create(db, collName) {
// TODO: should we ever do something different?
var myCollName = uniqueCollectionName(this.prefix, this.tid, this.num++);
assertAlways.commandWorked(db.createCollection(myCollName));
}
return {init: init, create: create};
})();
var transitions = {init: {create: 1}, create: {create: 1}};
return {
threadCount: 5,
iterations: 20,
data: data,
states: states,
transitions: transitions,
};
})();
|