blob: 59d6efebdeebcad006dbf657a075ffce98789a77 (
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
|
/**
* Tests that granularity update for sharded time-series collections is disabled for FCV < 6.0
*/
(function() {
"use strict";
load('./jstests/multiVersion/libs/multi_cluster.js');
function runTest(downgradeVersion) {
const st = new ShardingTest({shards: 1});
const dbName = "test";
const collName = jsTestName();
const viewNss = `${dbName}.${collName}`;
const timeField = "time";
const metaField = "meta";
const mongos = st.s;
const db = mongos.getDB(dbName);
assert.commandWorked(mongos.adminCommand({enableSharding: dbName}));
assert.commandWorked(db.createCollection(
collName,
{timeseries: {timeField: timeField, metaField: metaField, granularity: 'seconds'}}));
assert.commandWorked(mongos.adminCommand({
shardCollection: viewNss,
key: {[metaField]: 1},
}));
// Granularity updates works in 6.0
assert.commandWorked(db.runCommand({collMod: collName, timeseries: {granularity: 'minutes'}}));
// Granularity updates fails after downgrading.
assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: downgradeVersion}));
assert.commandFailedWithCode(
db.runCommand({collMod: collName, timeseries: {granularity: 'hours'}}),
ErrorCodes.NotImplemented);
st.stop();
}
runTest(lastLTSFCV);
})();
|