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

/**
 * indexed_insert_text_multikey.js
 *
 * like indexed_insert_text.js but the indexed value is an array of strings
 */
load('jstests/concurrency/fsm_libs/extend_workload.js');           // for extendWorkload
load('jstests/concurrency/fsm_workloads/indexed_insert_text.js');  // for $config

var $config = extendWorkload($config, function($config, $super) {

    $config.states.init = function init(db, collName) {
        $super.states.init.apply(this, arguments);
    };

    $config.data.getRandomTextSnippet = function getRandomTextSnippet() {
        var len = Random.randInt(5) + 1;  // ensure we always add some text, not just empty array
        var textArr = [];
        for (var i = 0; i < len; ++i) {
            textArr.push($super.data.getRandomTextSnippet.call(this, arguments));
        }
        return textArr;
    };

    // SERVER-21291: Reduce the thread count to alleviate PV1 failovers on
    // Windows DEBUG hosts.
    $config.threadCount = 5;

    // Remove the shard key, since it cannot be a multikey index
    delete $config.data.shardKey;

    return $config;
});