summaryrefslogtreecommitdiff
path: root/jstests/concurrency/fsm_workloads/collmod_separate_collections.js
blob: 615af927c1ba9cb2ad4257cfcf6cfb32ae3ba29a (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
'use strict';

/**
 * collmod_separate_collections.js
 *
 * Generates some random data and inserts it into a collection with a
 * TTL index. Runs a collMod command to change the value of the
 * expireAfterSeconds setting to a random integer.
 *
 * Each thread updates a TTL index on a separate collection.
 */
load('jstests/concurrency/fsm_libs/extend_workload.js');  // for extendWorkload
load('jstests/concurrency/fsm_workloads/collmod.js');     // for $config

var $config = extendWorkload($config, function($config, $super) {
    $config.data.prefix = 'collmod_separate_collections';
    $config.data.shardKey = {createdAt: 1};

    $config.states.init = function init(db, collName) {
        this.threadCollName = this.prefix + '_' + this.tid;
        $super.setup.call(this, db, this.threadCollName);
    };

    $config.transitions = Object.extend({init: {collMod: 1}}, $super.transitions);

    $config.setup = function setup(db, collName, cluster) {
        // no-op: since the init state is used to setup
        // the separate collections on a per-thread basis.
    };

    $config.startState = 'init';
    return $config;
});