mirror of https://github.com/mongodb/mongo
Revert "SERVER-112796 Make timeseries_collmod_timeseries_options.js work in multiversion suites" (#43653)
GitOrigin-RevId: d3cf9f404568bfe285883c3392f494ff0bd91783
This commit is contained in:
parent
792558bd8b
commit
8fe9348656
|
|
@ -951,7 +951,6 @@ 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_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/**/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/**/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/**/*.pem @10gen/server-security @svc-auto-approve-bot
|
||||||
/jstests/libs/**/*.sha1 @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
|
/jstests/libs/**/*.sha256 @10gen/server-security @svc-auto-approve-bot
|
||||||
|
|
@ -3092,6 +3091,7 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
|
||||||
/src/mongo/shell/**/encrypted* @10gen/server-security @svc-auto-approve-bot
|
/src/mongo/shell/**/encrypted* @10gen/server-security @svc-auto-approve-bot
|
||||||
/src/mongo/shell/**/keyvault.js @10gen/server-security @svc-auto-approve-bot
|
/src/mongo/shell/**/keyvault.js @10gen/server-security @svc-auto-approve-bot
|
||||||
/src/mongo/shell/**/named_pipe_test_helper* @10gen/query-integration-features @svc-auto-approve-bot
|
/src/mongo/shell/**/named_pipe_test_helper* @10gen/query-integration-features @svc-auto-approve-bot
|
||||||
|
/src/mongo/shell/**/feature_compatibility_version.js @10gen/server-fcv @svc-auto-approve-bot
|
||||||
|
|
||||||
# The following patterns are parsed from ./src/mongo/stdx/OWNERS.yml
|
# The following patterns are parsed from ./src/mongo/stdx/OWNERS.yml
|
||||||
/src/mongo/stdx/**/* @10gen/server-programmability @svc-auto-approve-bot
|
/src/mongo/stdx/**/* @10gen/server-programmability @svc-auto-approve-bot
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ export default [
|
||||||
// src/mongo/shell/feature_compatibility_version_global.js
|
// src/mongo/shell/feature_compatibility_version_global.js
|
||||||
binVersionToFCV: true,
|
binVersionToFCV: true,
|
||||||
checkFCV: true,
|
checkFCV: true,
|
||||||
|
isFCVEqual: true,
|
||||||
lastContinuousFCV: true,
|
lastContinuousFCV: true,
|
||||||
lastLTSFCV: true,
|
lastLTSFCV: true,
|
||||||
latestFCV: true,
|
latestFCV: true,
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
* ]
|
* ]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {isFCVgte} from "jstests/libs/feature_compatibility_version.js";
|
|
||||||
|
|
||||||
const coll = db["coll"];
|
const coll = db["coll"];
|
||||||
const indexField = "a";
|
const indexField = "a";
|
||||||
const bucketRoundingSecondsHours = 60 * 60 * 24;
|
const bucketRoundingSecondsHours = 60 * 60 * 24;
|
||||||
|
|
@ -27,7 +25,7 @@ function createTestColl() {
|
||||||
assert.commandWorked(coll.createIndex({[indexField]: 1}));
|
assert.commandWorked(coll.createIndex({[indexField]: 1}));
|
||||||
}
|
}
|
||||||
|
|
||||||
let timeseriesOptions = [
|
const timeseriesOptions = [
|
||||||
{"timeseries": {"granularity": "minutes"}},
|
{"timeseries": {"granularity": "minutes"}},
|
||||||
{
|
{
|
||||||
"timeseries": {
|
"timeseries": {
|
||||||
|
|
@ -35,15 +33,8 @@ let timeseriesOptions = [
|
||||||
"bucketRoundingSeconds": bucketRoundingSecondsHours,
|
"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 = [
|
const nonTimeseriesValidOptions = [
|
||||||
{"index": {"keyPattern": {[indexField]: 1}, "hidden": true}},
|
{"index": {"keyPattern": {[indexField]: 1}, "hidden": true}},
|
||||||
{"expireAfterSeconds": 60},
|
{"expireAfterSeconds": 60},
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,6 @@ filters:
|
||||||
- "host_ipaddr.js":
|
- "host_ipaddr.js":
|
||||||
approvers:
|
approvers:
|
||||||
- 10gen/server-networking-and-observability
|
- 10gen/server-networking-and-observability
|
||||||
- "feature_compatibility_version.js":
|
|
||||||
approvers:
|
|
||||||
- 10gen/server-fcv
|
|
||||||
- "*.pem":
|
- "*.pem":
|
||||||
approvers:
|
approvers:
|
||||||
- 10gen/server-security
|
- 10gen/server-security
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,6 @@ const latest = "latest";
|
||||||
// Windows is slower but usually can make it in 4s, so we allow it to finish in 6s.
|
// Windows is slower but usually can make it in 4s, so we allow it to finish in 6s.
|
||||||
const timeoutSeconds = _isWindows() ? 6 : 3;
|
const timeoutSeconds = _isWindows() ? 6 : 3;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if checkFCV runs successfully.
|
|
||||||
*/
|
|
||||||
function isFCVEqual(adminDB, version, targetVersion) {
|
|
||||||
try {
|
|
||||||
checkFCV(adminDB, version, targetVersion);
|
|
||||||
} catch (e) {
|
|
||||||
jsTestLog("checkFCV failed with error: " + tojson(e));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function runStandaloneTest() {
|
function runStandaloneTest() {
|
||||||
jsTestLog("Running standalone test");
|
jsTestLog("Running standalone test");
|
||||||
const conn = MongoRunner.runMongod({binVersion: latest});
|
const conn = MongoRunner.runMongod({binVersion: latest});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||||
load("@poetry//:dependencies.bzl", "dependency")
|
load("@poetry//:dependencies.bzl", "dependency")
|
||||||
load("//bazel:mongo_js_rules.bzl", "mongo_js_library")
|
|
||||||
load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_binary", "mongo_cc_library", "mongo_cc_unit_test", "windows_rc")
|
load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_binary", "mongo_cc_library", "mongo_cc_unit_test", "windows_rc")
|
||||||
load("//bazel/config:render_template.bzl", "render_template")
|
load("//bazel/config:render_template.bzl", "render_template")
|
||||||
|
|
||||||
|
|
@ -324,6 +324,7 @@ MONGO_SERVER_CPP_JS_FILES = [
|
||||||
"bridge_global.js",
|
"bridge_global.js",
|
||||||
"data_consistency_checker.js",
|
"data_consistency_checker.js",
|
||||||
"data_consistency_checker_global.js",
|
"data_consistency_checker_global.js",
|
||||||
|
"feature_compatibility_version.js",
|
||||||
"feature_compatibility_version_global.js",
|
"feature_compatibility_version_global.js",
|
||||||
"keyvault.js",
|
"keyvault.js",
|
||||||
"servers.js",
|
"servers.js",
|
||||||
|
|
@ -548,6 +549,8 @@ mongo_cc_unit_test(
|
||||||
deps = ["shell_test_dependencies"],
|
deps = ["shell_test_dependencies"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
load("//bazel:mongo_js_rules.bzl", "mongo_js_library")
|
||||||
|
|
||||||
mongo_js_library(
|
mongo_js_library(
|
||||||
name = "all",
|
name = "all",
|
||||||
srcs = glob([
|
srcs = glob([
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,6 @@ filters:
|
||||||
- "named_pipe_test_helper*":
|
- "named_pipe_test_helper*":
|
||||||
approvers:
|
approvers:
|
||||||
- 10gen/query-integration-features
|
- 10gen/query-integration-features
|
||||||
|
- "feature_compatibility_version.js":
|
||||||
|
approvers:
|
||||||
|
- 10gen/server-fcv
|
||||||
|
|
|
||||||
|
|
@ -1,56 +1,30 @@
|
||||||
/**
|
// Contains helpers for checking the featureCompatibilityVersion and constants for the current
|
||||||
* Contains helpers for checking the featureCompatibilityVersion.
|
// featureCompatibilityVersion values.
|
||||||
*/
|
|
||||||
|
|
||||||
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.
|
* These constants represent the current "latest", "last-continuous" and "last-lts" values for the
|
||||||
|
* featureCompatibilityVersion parameter. They should only be used for testing of upgrade-downgrade
|
||||||
|
* scenarios that are intended to be maintained between releases.
|
||||||
|
*
|
||||||
|
* We cannot use `const` when declaring them because it must be possible to load() this file
|
||||||
|
* multiple times.
|
||||||
*/
|
*/
|
||||||
export function isStableFCVSuite() {
|
|
||||||
return !TestData.isRunningFCVUpgradeDowngradeSuite;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isFCVgt(conn, targetVersion) {
|
let fcvConstants = getFCVConstants();
|
||||||
const lowestFCV = isStableFCVSuite() ? getCurrentFCV(conn) : lastLTSFCV;
|
|
||||||
return MongoRunner.compareBinVersions(lowestFCV, targetVersion) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isFCVgte(conn, targetVersion) {
|
let latestFCV = fcvConstants.latest;
|
||||||
const lowestFCV = isStableFCVSuite() ? getCurrentFCV(conn) : lastLTSFCV;
|
let lastContinuousFCV = fcvConstants.lastContinuous;
|
||||||
return MongoRunner.compareBinVersions(lowestFCV, targetVersion) >= 0;
|
let lastLTSFCV = fcvConstants.lastLTS;
|
||||||
}
|
// The number of versions since the last-lts version. When numVersionsSinceLastLTS = 1,
|
||||||
|
// lastContinuousFCV is equal to lastLTSFCV. This is used to calculate the expected minWireVersion
|
||||||
export function isFCVlt(conn, targetVersion) {
|
// in jstests that use the lastLTSFCV.
|
||||||
const highestFCV = isStableFCVSuite() ? getCurrentFCV(conn) : latestFCV;
|
let numVersionsSinceLastLTS = fcvConstants.numSinceLastLTS;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the FCV associated with a binary version.
|
* Returns the FCV associated with a binary version.
|
||||||
* eg. An input of 'last-lts' will return lastLTSFCV.
|
* eg. An input of 'last-lts' will return lastLTSFCV.
|
||||||
*/
|
*/
|
||||||
export function binVersionToFCV(binVersion) {
|
function binVersionToFCV(binVersion) {
|
||||||
if (binVersion === "latest") {
|
if (binVersion === "latest") {
|
||||||
return latestFCV;
|
return latestFCV;
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +38,7 @@ export function binVersionToFCV(binVersion) {
|
||||||
* of the form {featureCompatibilityVersion: {version: <required>, targetVersion: <optional>,
|
* of the form {featureCompatibilityVersion: {version: <required>, targetVersion: <optional>,
|
||||||
* previousVersion: <optional>}, ok: 1}.
|
* previousVersion: <optional>}, ok: 1}.
|
||||||
*/
|
*/
|
||||||
export function checkFCV(adminDB, version, targetVersion, isCleaningServerMetadata) {
|
function checkFCV(adminDB, version, targetVersion, isCleaningServerMetadata) {
|
||||||
// When both version and targetVersion are equal to lastContinuousFCV or lastLTSFCV, downgrade
|
// When both version and targetVersion are equal to lastContinuousFCV or lastLTSFCV, downgrade
|
||||||
// is in progress. This tests that previousVersion is always equal to latestFCV in downgrading
|
// is in progress. This tests that previousVersion is always equal to latestFCV in downgrading
|
||||||
// states or undefined otherwise.
|
// states or undefined otherwise.
|
||||||
|
|
@ -135,10 +109,23 @@ export function checkFCV(adminDB, version, targetVersion, isCleaningServerMetada
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if checkFCV runs successfully.
|
||||||
|
*/
|
||||||
|
function isFCVEqual(adminDB, version, targetVersion) {
|
||||||
|
try {
|
||||||
|
checkFCV(adminDB, version, targetVersion);
|
||||||
|
} catch (e) {
|
||||||
|
jsTestLog("checkFCV failed with error: " + tojson(e));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since SERVER-29453 disallowed removal of the FCV document, we need to do this hack to remove it.
|
* Since SERVER-29453 disallowed removal of the FCV document, we need to do this hack to remove it.
|
||||||
*/
|
*/
|
||||||
export function removeFCVDocument(adminDB) {
|
function removeFCVDocument(adminDB) {
|
||||||
let res = adminDB.runCommand({listCollections: 1, filter: {name: "system.version"}});
|
let res = adminDB.runCommand({listCollections: 1, filter: {name: "system.version"}});
|
||||||
assert.commandWorked(res, "failed to list collections");
|
assert.commandWorked(res, "failed to list collections");
|
||||||
let originalUUID = res.cursor.firstBatch[0].info.uuid;
|
let originalUUID = res.cursor.firstBatch[0].info.uuid;
|
||||||
|
|
@ -174,7 +161,7 @@ export function removeFCVDocument(adminDB) {
|
||||||
*
|
*
|
||||||
* 'testFunc' is expected to be a function that accepts a valid downgrade FCV as input.
|
* 'testFunc' is expected to be a function that accepts a valid downgrade FCV as input.
|
||||||
*/
|
*/
|
||||||
export function runFeatureFlagMultiversionTest(featureFlag, testFunc) {
|
function runFeatureFlagMultiversionTest(featureFlag, testFunc) {
|
||||||
jsTestLog("Running standalone to gather parameter info about featureFlag: " + featureFlag);
|
jsTestLog("Running standalone to gather parameter info about featureFlag: " + featureFlag);
|
||||||
// Spin up a standalone to check the release version of 'featureFlag'.
|
// Spin up a standalone to check the release version of 'featureFlag'.
|
||||||
let standalone = MongoRunner.runMongod();
|
let standalone = MongoRunner.runMongod();
|
||||||
|
|
@ -207,3 +194,15 @@ export function runFeatureFlagMultiversionTest(featureFlag, testFunc) {
|
||||||
testFunc(lastContinuousFCV);
|
testFunc(lastContinuousFCV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
binVersionToFCV,
|
||||||
|
checkFCV,
|
||||||
|
isFCVEqual,
|
||||||
|
lastContinuousFCV,
|
||||||
|
lastLTSFCV,
|
||||||
|
latestFCV,
|
||||||
|
numVersionsSinceLastLTS,
|
||||||
|
removeFCVDocument,
|
||||||
|
runFeatureFlagMultiversionTest,
|
||||||
|
};
|
||||||
|
|
@ -3,30 +3,21 @@
|
||||||
import {
|
import {
|
||||||
binVersionToFCV,
|
binVersionToFCV,
|
||||||
checkFCV,
|
checkFCV,
|
||||||
|
isFCVEqual,
|
||||||
|
lastContinuousFCV,
|
||||||
|
lastLTSFCV,
|
||||||
|
latestFCV,
|
||||||
|
numVersionsSinceLastLTS,
|
||||||
removeFCVDocument,
|
removeFCVDocument,
|
||||||
runFeatureFlagMultiversionTest,
|
runFeatureFlagMultiversionTest,
|
||||||
} from "jstests/libs/feature_compatibility_version.js";
|
} from "src/mongo/shell/feature_compatibility_version.js";
|
||||||
|
|
||||||
/**
|
|
||||||
* These constants represent the current "latest", "last-continuous" and "last-lts" values for the
|
|
||||||
* featureCompatibilityVersion parameter. They should only be used for testing of upgrade-downgrade
|
|
||||||
* scenarios that are intended to be maintained between releases.
|
|
||||||
*
|
|
||||||
* We cannot use `const` when declaring them because it must be possible to load() this file
|
|
||||||
* multiple times.
|
|
||||||
*/
|
|
||||||
|
|
||||||
let fcvConstants = getFCVConstants();
|
|
||||||
|
|
||||||
globalThis.lastContinuousFCV = fcvConstants.lastContinuous;
|
|
||||||
globalThis.lastLTSFCV = fcvConstants.lastLTS;
|
|
||||||
globalThis.latestFCV = fcvConstants.latest;
|
|
||||||
// The number of versions since the last-lts version. When numVersionsSinceLastLTS = 1,
|
|
||||||
// lastContinuousFCV is equal to lastLTSFCV. This is used to calculate the expected minWireVersion
|
|
||||||
// in jstests that use the lastLTSFCV.
|
|
||||||
globalThis.numVersionsSinceLastLTS = fcvConstants.numSinceLastLTS;
|
|
||||||
|
|
||||||
globalThis.binVersionToFCV = binVersionToFCV;
|
globalThis.binVersionToFCV = binVersionToFCV;
|
||||||
globalThis.checkFCV = checkFCV;
|
globalThis.checkFCV = checkFCV;
|
||||||
|
globalThis.isFCVEqual = isFCVEqual;
|
||||||
|
globalThis.lastContinuousFCV = lastContinuousFCV;
|
||||||
|
globalThis.lastLTSFCV = lastLTSFCV;
|
||||||
|
globalThis.latestFCV = latestFCV;
|
||||||
|
globalThis.numVersionsSinceLastLTS = numVersionsSinceLastLTS;
|
||||||
globalThis.removeFCVDocument = removeFCVDocument;
|
globalThis.removeFCVDocument = removeFCVDocument;
|
||||||
globalThis.runFeatureFlagMultiversionTest = runFeatureFlagMultiversionTest;
|
globalThis.runFeatureFlagMultiversionTest = runFeatureFlagMultiversionTest;
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ extern const JSFile bridge;
|
||||||
extern const JSFile bridge_global;
|
extern const JSFile bridge_global;
|
||||||
extern const JSFile data_consistency_checker;
|
extern const JSFile data_consistency_checker;
|
||||||
extern const JSFile data_consistency_checker_global;
|
extern const JSFile data_consistency_checker_global;
|
||||||
|
extern const JSFile feature_compatibility_version;
|
||||||
extern const JSFile feature_compatibility_version_global;
|
extern const JSFile feature_compatibility_version_global;
|
||||||
extern const JSFile servers;
|
extern const JSFile servers;
|
||||||
extern const JSFile servers_global;
|
extern const JSFile servers_global;
|
||||||
|
|
@ -1315,6 +1316,7 @@ void initScope(Scope& scope) {
|
||||||
// modules
|
// modules
|
||||||
scope.execSetup(JSFiles::bridge);
|
scope.execSetup(JSFiles::bridge);
|
||||||
scope.execSetup(JSFiles::data_consistency_checker);
|
scope.execSetup(JSFiles::data_consistency_checker);
|
||||||
|
scope.execSetup(JSFiles::feature_compatibility_version);
|
||||||
scope.execSetup(JSFiles::servers);
|
scope.execSetup(JSFiles::servers);
|
||||||
scope.execSetup(JSFiles::servers_misc);
|
scope.execSetup(JSFiles::servers_misc);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue