summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/timeseries_server_parameters.js
blob: 760ffd429a7e4b2dc62fc996f546f327fcb55734 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Tests time-series server parameter settings on server startup.

 * @tags: [
 *   requires_replication
 * ]
 */

(function() {
'use strict';

load("jstests/core/timeseries/libs/timeseries.js");
load("jstests/noPassthrough/libs/server_parameter_helpers.js");

// Test that collection clustering can be disabled on the buckets collection, and that it behaves
// correctly in a replicated environment.
(() => {
    const replSet = new ReplSetTest({
        nodes: 2,
        nodeOptions: {setParameter: {timeseriesBucketsCollectionClusterById: false}},
    });
    replSet.startSet();
    replSet.initiate();

    const primary = replSet.getPrimary();
    if (!TimeseriesTest.timeseriesCollectionsEnabled(primary)) {
        jsTestLog("Skipping test case because time-series collections are not enabled.");
        replSet.stopSet();
        return;
    }

    const testDB = primary.getDB('test');
    assert.commandWorked(testDB.createCollection('ts', {timeseries: {timeField: 'time'}}));
    testDB.ts.insert({time: new Date()});

    let res = assert.commandWorked(
        testDB.runCommand({listCollections: 1, filter: {name: 'system.buckets.ts'}}));
    let options = res.cursor.firstBatch[0].options;
    assert(!options.clusteredIndex);

    replSet.stopSet();
})();

// Valid parameter values are in the range [0, infinity).
testNumericServerParameter('timeseriesBucketMaxCount',
                           true /*isStartupParameter*/,
                           false /*isRuntimeParameter*/,
                           1000 /*defaultValue*/,
                           100 /*nonDefaultValidValue*/,
                           true /*hasLowerBound*/,
                           0 /*lowerOutOfBounds*/,
                           false /*hasUpperBound*/,
                           "unused" /*upperOutOfBounds*/);

// Valid parameter values are in the range [0, infinity).
testNumericServerParameter('timeseriesBucketMaxSize',
                           true /*isStartupParameter*/,
                           false /*isRuntimeParameter*/,
                           1024 * 125 /*defaultValue*/,
                           1024 /*nonDefaultValidValue*/,
                           true /*hasLowerBound*/,
                           0 /*lowerOutOfBounds*/,
                           false /*hasUpperBound*/,
                           "unused" /*upperOutOfBounds*/);

// Valid parameter values are in the range [0, infinity).
testNumericServerParameter('timeseriesIdleBucketExpiryMemoryUsageThreshold',
                           true /*isStartupParameter*/,
                           false /*isRuntimeParameter*/,
                           1024 * 1024 * 100 /*defaultValue*/,
                           1024 /*nonDefaultValidValue*/,
                           true /*hasLowerBound*/,
                           0 /*lowerOutOfBounds*/,
                           false /*hasUpperBound*/,
                           "unused" /*upperOutOfBounds*/);
})();