SERVER-118708 Bring back stub for removed 'changeStreams' server parameter (#47443)

GitOrigin-RevId: ec60638eb6ae17d9b59b7b52ee78c6a47a6b9fcd
This commit is contained in:
Jan 2026-02-03 21:04:04 +01:00 committed by MongoDB Bot
parent df8c894b19
commit d77872ce25
12 changed files with 285 additions and 3 deletions

3
.github/CODEOWNERS vendored
View File

@ -1158,6 +1158,9 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
# The following patterns are parsed from ./jstests/multiVersion/genericBinVersion/query-execution/OWNERS.yml
/jstests/multiVersion/genericBinVersion/query-execution/ @10gen/query-execution @svc-auto-approve-bot
# The following patterns are parsed from ./jstests/multiVersion/genericBinVersion/query-execution-change-streams/OWNERS.yml
/jstests/multiVersion/genericBinVersion/query-execution-change-streams/ @10gen/query-execution-change-streams @svc-auto-approve-bot
# The following patterns are parsed from ./jstests/multiVersion/genericBinVersion/query-execution-classic/OWNERS.yml
/jstests/multiVersion/genericBinVersion/query-execution-classic/ @10gen/query-execution-classic @svc-auto-approve-bot

View File

@ -32,6 +32,10 @@ export const kNonTestOnlyClusterParameters = {
testValues: [{preAndPostImages: {expireAfterSeconds: 30}}, {preAndPostImages: {expireAfterSeconds: 20}}],
setParameters: {"multitenancySupport": false},
},
changeStreams: {
default: {expireAfterSeconds: NumberLong(3600)},
testValues: [{expireAfterSeconds: 30}, {expireAfterSeconds: 10}],
},
defaultMaxTimeMS: {
default: {readOperations: 0},
testValues: [{readOperations: 42}, {readOperations: 60000}],

View File

@ -0,0 +1,12 @@
load("//bazel:mongo_js_rules.bzl", "all_subpackage_javascript_files", "mongo_js_library")
package(default_visibility = ["//visibility:public"])
mongo_js_library(
name = "all_javascript_files",
srcs = glob([
"*.js",
]),
)
all_subpackage_javascript_files()

View File

@ -0,0 +1,5 @@
version: 2.0.0
filters:
- "*":
approvers:
- 10gen/query-execution-change-streams

View File

@ -0,0 +1,32 @@
/**
* Verifies that deprecated (stubbed) change streams cluster parameters still work
* after upgrading to latest bin version.
*/
import {testPerformUpgradeSharded} from "jstests/multiVersion/libs/mixed_version_sharded_fixture_test.js";
function assertParametersWork(primaryConnection) {
// The 'changeStreams' parameter was marked as deprecated in v8.3 and does nothing.
// To keep downwards-compatibility, it is still required that the parameter can be
// set and requested without error.
assert.commandWorked(
primaryConnection.adminCommand({setClusterParameter: {changeStreams: {expireAfterSeconds: 3600}}}),
);
const clusterParameters = assert.commandWorked(
primaryConnection.adminCommand({getClusterParameter: "changeStreams"}),
).clusterParameters;
assert.eq(1, clusterParameters.length);
assert.eq("changeStreams", clusterParameters[0]._id);
assert.eq(NumberLong(3600), clusterParameters[0].expireAfterSeconds);
}
testPerformUpgradeSharded({
setupFn: assertParametersWork,
whenFullyDowngraded: assertParametersWork,
whenOnlyConfigIsLatestBinary: assertParametersWork,
whenSecondariesAndConfigAreLatestBinary: assertParametersWork,
whenMongosBinaryIsLastLTS: assertParametersWork,
whenBinariesAreLatestAndFCVIsLastLTS: assertParametersWork,
whenFullyUpgraded: assertParametersWork,
});

View File

@ -89,9 +89,6 @@ function runTest(fcvVersion, binaryVersion) {
newCPs.sort(bsonWoCompare);
oldCPs.sort(bsonWoCompare);
// Filter out "changeStreams" server parameter from old version, as it got removed in v8.3.
oldCPs = oldCPs.filter((cp) => cp._id !== "changeStreams");
assert.eq(
bsonWoCompare(newCPs, oldCPs),
0,

View File

@ -471,6 +471,15 @@ idl_generator(
src = "change_stream_options_parameter.idl",
)
idl_generator(
name = "change_streams_cluster_parameter_gen",
src = "change_streams_cluster_parameter.idl",
deps = [
":basic_types_gen",
"//src/mongo/db/topology/cluster_parameters:cluster_server_parameter_gen",
],
)
mongo_cc_library(
name = "audit",
srcs = [
@ -1934,6 +1943,20 @@ mongo_cc_library(
],
)
mongo_cc_library(
name = "change_streams_cluster_parameter",
srcs = [
"change_streams_cluster_parameter.cpp",
":change_streams_cluster_parameter_gen",
],
deps = [
":server_base",
"//src/mongo/db/repl:repl_coordinator_interface",
"//src/mongo/db/repl:repl_settings",
"//src/mongo/db/topology/cluster_parameters:cluster_server_parameter",
],
)
mongo_cc_library(
name = "keys_collection_client_direct",
srcs = [
@ -2604,6 +2627,7 @@ mongo_cc_library(
"//src/mongo/db/repl/dbcheck:health_log",
"//src/mongo/db/repl/dbcheck:health_log_interface",
"//src/mongo/db/shard_role:resource_yielders",
"change_streams_cluster_parameter",
"change_stream_options_manager",
"//src/mongo/db/commands:mongod",
"//src/mongo/db/commands:mongod_fsync",

View File

@ -0,0 +1,53 @@
/**
* Copyright (C) 2022-present MongoDB, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the Server Side Public License in all respects for
* all of the code used other than as permitted herein. If you modify file(s)
* with this exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
#include "mongo/db/change_streams_cluster_parameter.h"
#include "mongo/base/error_codes.h"
#include "mongo/base/status.h"
#include "mongo/db/change_streams_cluster_parameter_gen.h"
#include "mongo/db/server_options.h"
#include <boost/optional/optional.hpp>
namespace mongo {
Status validateChangeStreamsClusterParameter(
const ChangeStreamsClusterParameterStorage& clusterParameter,
const boost::optional<TenantId>&) {
if (clusterParameter.getExpireAfterSeconds() <= 0) {
return Status(ErrorCodes::BadValue,
"Expected a positive integer for 'expireAfterSeconds' field");
}
return Status::OK();
}
} // namespace mongo

View File

@ -0,0 +1,49 @@
/**
* Copyright (C) 2022-present MongoDB, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the Server Side Public License in all respects for
* all of the code used other than as permitted herein. If you modify file(s)
* with this exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
#pragma once
#include "mongo/base/status.h"
#include "mongo/db/tenant_id.h"
#include <boost/optional.hpp>
#include <boost/optional/optional.hpp>
namespace mongo {
class ChangeStreamsClusterParameterStorage;
/**
* Validates 'changeStreams' cluster-wide parameter.
* This functionality is only here for downwards-compatibility reasons.
* The 'changeStreams' cluster-wide parameter has no purpose anymore.
*/
Status validateChangeStreamsClusterParameter(
const ChangeStreamsClusterParameterStorage& clusterParameter, const boost::optional<TenantId>&);
} // namespace mongo

View File

@ -0,0 +1,100 @@
# Copyright (C) 2022-present MongoDB, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Server Side Public License, version 1,
# as published by MongoDB, Inc.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Server Side Public License for more details.
#
# You should have received a copy of the Server Side Public License
# along with this program. If not, see
# <http://www.mongodb.com/licensing/server-side-public-license>.
#
# As a special exception, the copyright holders give permission to link the
# code of portions of this program with the OpenSSL library under certain
# conditions as described in each individual source file and distribute
# linked combinations including the program with the OpenSSL library. You
# must comply with the Server Side Public License in all respects for
# all of the code used other than as permitted herein. If you modify file(s)
# with this exception, you may extend this exception to your version of the
# file(s), but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version. If you delete this
# exception statement from all source files in the program, then also delete
# it in the license file.
#
global:
cpp_namespace: "mongo"
cpp_includes:
- "mongo/db/change_streams_cluster_parameter.h"
imports:
- "mongo/db/basic_types.idl"
- "mongo/db/topology/cluster_parameters/cluster_server_parameter.idl"
# Note: the parameters is this file are only present for downwards-compatibility
# reasons. They serve no other purpose than facilitating upgrades from older
# versions that used these parameters.
structs:
ChangeStreamsClusterParameterStorage:
description: >-
A specification for the 'changeStreams' cluster-wide configuration parameter
type.
inline_chained_structs: true
chained_structs:
ClusterServerParameter: clusterServerParameter
fields:
expireAfterSeconds:
description: >-
The number of seconds to retain the change events. This value will be a
non-zero positive value if the change stream is enabled and a zero value if the change
stream is disabled.
This parameter is deprecated, and its value is not used after setting it.
type: safeInt64
default: 60 * 60
server_parameters:
changeStreams:
description: >-
The cluster-wide configuration parameter for the change stream in the serverless.
This parameter is deprecated, and its value is not used after setting it.
set_at: cluster
omit_in_ftdc: false
cpp_vartype: ChangeStreamsClusterParameterStorage
cpp_varname: gChangeStreamsClusterParameter
validator:
callback: validateChangeStreamsClusterParameter
condition:
min_fcv: 6.2
redact: false
is_deprecated: true
changeCollectionExpiredDocumentsRemoverJobSleepSeconds:
description: >-
Specifies the number of seconds for which the periodic change collection remover
job in serverless will sleep between each cycle.
This parameter is deprecated, and its value is not used after setting it.
set_at: [startup]
cpp_vartype: AtomicWord<int>
cpp_varname: "gChangeCollectionExpiredDocumentsRemoverJobSleepSeconds"
validator:
gte: 1
default: 10
redact: false
is_deprecated: true
disableExpiredChangeCollectionRemover:
description: >-
Disables the expired change collection remover in serverless.
This parameter is deprecated, and its value is not used after setting it.
set_at: [startup]
cpp_vartype: bool
cpp_varname: gChangeCollectionRemoverDisabled
default: false
test_only: true
redact: false
is_deprecated: true

View File

@ -19,6 +19,8 @@
##
global:
cpp_namespace: "mongo::feature_flags"
cpp_includes:
- "mongo/db/change_streams_cluster_parameter.h"
imports:
- "mongo/db/basic_types.idl"

View File

@ -603,6 +603,7 @@ mongo_cc_library(
"//src/mongo/db:startup_warnings_common",
"//src/mongo/db/stats:system_buckets_metrics",
"//src/mongo/db/topology/cluster_parameters:cluster_server_parameter_refresher",
"//src/mongo/db:change_streams_cluster_parameter",
"//src/mongo/otel/traces:tracing_initialization",
"//src/mongo/transport:ingress_handshake_metrics",
"//src/mongo/transport:service_executor",