Files
mongo/jstests/concurrency/fsm_workloads/create_collection.js
alabid f6a65290f2 SERVER-16648 Additional FSM-based concurrency workloads with some cleanup and blacklisting
Includes workloads for:
    explain
    compact
    reindex
    collMod
    count
    distinct
    touch
    $where
Added to blacklists in FSM runners
Fixed the way we check for storage engines
Added two options for arbitrary function execution against cluster:
    - Specified via ClusterOptions as setupFunctions to be run on the
      cluster before workloads are run
    - As part of setup and teardown with the cluster provided as a third
      argument to these workload functions
2015-02-05 16:14:37 -05:00

62 lines
1.4 KiB
JavaScript

'use strict';
/**
* create_collection.js
*
* Repeatedly creates a collection.
*/
load('jstests/concurrency/fsm_workload_helpers/drop_utils.js'); // for dropCollections
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 }
};
function teardown(db, collName, cluster) {
var pattern = new RegExp('^' + this.prefix + '\\d+_\\d+$');
dropCollections(db, pattern);
}
return {
threadCount: 5,
iterations: 20,
data: data,
states: states,
transitions: transitions,
teardown: teardown
};
})();