mirror of https://github.com/mongodb/mongo
SERVER-112796 Make timeseries_collmod_timeseries_options.js work in multiversion suites (#43664)
GitOrigin-RevId: 83594685d90efadcf8fd4eb890170673bc2344ee
This commit is contained in:
parent
3330c258bf
commit
c58ca44b76
|
|
@ -955,6 +955,7 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
|
|||
/jstests/libs/**/replicated_ident_utils.js @10gen/server-storage-engine-integration @svc-auto-approve-bot
|
||||
/jstests/libs/**/replicated_record_ids_utils.js @10gen/server-storage-engine-integration @svc-auto-approve-bot
|
||||
/jstests/libs/**/host_ipaddr.js @10gen/server-networking-and-observability @svc-auto-approve-bot
|
||||
/jstests/libs/**/feature_compatibility_version.js @10gen/server-fcv @svc-auto-approve-bot
|
||||
/jstests/libs/**/*.pem @10gen/server-security @svc-auto-approve-bot
|
||||
/jstests/libs/**/*.sha1 @10gen/server-security @svc-auto-approve-bot
|
||||
/jstests/libs/**/*.sha256 @10gen/server-security @svc-auto-approve-bot
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
* ]
|
||||
*/
|
||||
|
||||
import {isFCVgte} from "jstests/libs/feature_compatibility_version.js";
|
||||
|
||||
const coll = db["coll"];
|
||||
const indexField = "a";
|
||||
const bucketRoundingSecondsHours = 60 * 60 * 24;
|
||||
|
|
@ -25,7 +27,7 @@ function createTestColl() {
|
|||
assert.commandWorked(coll.createIndex({[indexField]: 1}));
|
||||
}
|
||||
|
||||
const timeseriesOptions = [
|
||||
let timeseriesOptions = [
|
||||
{"timeseries": {"granularity": "minutes"}},
|
||||
{
|
||||
"timeseries": {
|
||||
|
|
@ -33,8 +35,15 @@ const timeseriesOptions = [
|
|||
"bucketRoundingSeconds": bucketRoundingSecondsHours,
|
||||
},
|
||||
},
|
||||
{"timeseriesBucketsMayHaveMixedSchemaData": true},
|
||||
];
|
||||
|
||||
// TODO SERVER-105548 always include `timeseriesBucketsMayHaveMixedSchemaData` in the list of timeseries options above.
|
||||
if (isFCVgte(db, "8.3")) {
|
||||
// Starting from SERVER-105337 (8.3) we started blocking CRUD operations also for
|
||||
// timeseriesBucketsMayHaveMixedSchemaData collmod options.
|
||||
timeseriesOptions.push({"timeseriesBucketsMayHaveMixedSchemaData": true});
|
||||
}
|
||||
|
||||
const nonTimeseriesValidOptions = [
|
||||
{"index": {"keyPattern": {[indexField]: 1}, "hidden": true}},
|
||||
{"expireAfterSeconds": 60},
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ filters:
|
|||
- "host_ipaddr.js":
|
||||
approvers:
|
||||
- 10gen/server-networking-and-observability
|
||||
- "feature_compatibility_version.js":
|
||||
approvers:
|
||||
- 10gen/server-fcv
|
||||
- "*.pem":
|
||||
approvers:
|
||||
- 10gen/server-security
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* Utility function for working with cluster Feature Compatibilty Version.
|
||||
*/
|
||||
|
||||
function getFCVDocument(conn) {
|
||||
let adminDB = typeof conn.getDB === "function" ? conn.getDB("admin") : conn.getSiblingDB("admin");
|
||||
return adminDB["system.version"].findOne({_id: "featureCompatibilityVersion"});
|
||||
}
|
||||
|
||||
export function getCurrentFCV(conn) {
|
||||
const FCVDoc = getFCVDocument(conn);
|
||||
assert(FCVDoc, "Failed to retrieve FCV document");
|
||||
return FCVDoc.version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if we are running in a test suite with stable FCV.
|
||||
*/
|
||||
export function isStableFCVSuite() {
|
||||
return !TestData.isRunningFCVUpgradeDowngradeSuite;
|
||||
}
|
||||
|
||||
export function isFCVgt(conn, targetVersion) {
|
||||
const lowestFCV = isStableFCVSuite() ? getCurrentFCV(conn) : lastLTSFCV;
|
||||
return MongoRunner.compareBinVersions(lowestFCV, targetVersion) > 0;
|
||||
}
|
||||
|
||||
export function isFCVgte(conn, targetVersion) {
|
||||
const lowestFCV = isStableFCVSuite() ? getCurrentFCV(conn) : lastLTSFCV;
|
||||
return MongoRunner.compareBinVersions(lowestFCV, targetVersion) >= 0;
|
||||
}
|
||||
|
||||
export function isFCVlt(conn, targetVersion) {
|
||||
const highestFCV = isStableFCVSuite() ? getCurrentFCV(conn) : latestFCV;
|
||||
return MongoRunner.compareBinVersions(highestFCV, targetVersion) < 0;
|
||||
}
|
||||
|
||||
export function isFCVlte(conn, targetVersion) {
|
||||
const highestFCV = isStableFCVSuite() ? getCurrentFCV(conn) : latestFCV;
|
||||
return MongoRunner.compareBinVersions(highestFCV, targetVersion) <= 0;
|
||||
}
|
||||
|
||||
export function isFCVeq(conn, targetVersion) {
|
||||
assert(isStableFCVSuite(), "Can't use `isFCVeq` function in suites that perform backround FCV transitions.");
|
||||
const currentFCV = getCurrentFCV(conn);
|
||||
return MongoRunner.compareBinVersions(currentFCV, targetVersion) == 0;
|
||||
}
|
||||
Loading…
Reference in New Issue