diff options
author | Louis Williams <louis.williams@mongodb.com> | 2021-03-09 14:57:18 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-09 20:41:35 +0000 |
commit | 82df46317a5e23256fdc613dd10a4a11f85e8648 (patch) | |
tree | 97c05613a413b2c2ddca3e51b40b6def096fd576 /jstests/noPassthrough/timeseries_server_parameters.js | |
parent | 0d3bc8f05bf481553e70bd14adfea125c871e06e (diff) | |
download | mongo-82df46317a5e23256fdc613dd10a4a11f85e8648.tar.gz |
SERVER-54965 Flag to disable clustering by _id on time-series collections
Diffstat (limited to 'jstests/noPassthrough/timeseries_server_parameters.js')
-rw-r--r-- | jstests/noPassthrough/timeseries_server_parameters.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/jstests/noPassthrough/timeseries_server_parameters.js b/jstests/noPassthrough/timeseries_server_parameters.js index a2c87c9617b..de975c93f21 100644 --- a/jstests/noPassthrough/timeseries_server_parameters.js +++ b/jstests/noPassthrough/timeseries_server_parameters.js @@ -3,8 +3,38 @@ (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*/, |