summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/cluster_server_parameter_refresher.js
diff options
context:
space:
mode:
authorauto-revert-processor <dev-prod-dag@mongodb.com>2022-12-15 00:10:57 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-15 00:40:44 +0000
commitf12d0b467c8c995fdb9fd0e737809f99c99397f7 (patch)
treeb923af60930a9c96bd6e9a6e844257956dfaffb4 /jstests/noPassthrough/cluster_server_parameter_refresher.js
parentf9de54941333144d93e69eb58ea758b70f8f5cbe (diff)
downloadmongo-f12d0b467c8c995fdb9fd0e737809f99c99397f7.tar.gz
Revert "SERVER-71767 In ClusterServerParameterRefresher, don't delete non-updated parameters"
This reverts commit 49e41485fdd0501fe7f1ed642d12fd59d3f30b9e.
Diffstat (limited to 'jstests/noPassthrough/cluster_server_parameter_refresher.js')
-rw-r--r--jstests/noPassthrough/cluster_server_parameter_refresher.js66
1 files changed, 28 insertions, 38 deletions
diff --git a/jstests/noPassthrough/cluster_server_parameter_refresher.js b/jstests/noPassthrough/cluster_server_parameter_refresher.js
index a7a623024be..1c799402395 100644
--- a/jstests/noPassthrough/cluster_server_parameter_refresher.js
+++ b/jstests/noPassthrough/cluster_server_parameter_refresher.js
@@ -12,35 +12,22 @@
(function() {
'use strict';
-load('jstests/libs/cluster_server_parameter_utils.js');
-
function runTest(st, startupRefreshIntervalMS) {
- // This assert is necessary because we subtract 8000 MS from this value later on, and we don't
- // want the interval to go below 1 second.
- assert(startupRefreshIntervalMS >= 9000);
// First, check that the mongos logs a refresh attempt within the first refreshIntervalMS
// milliseconds that finds no documents on the config servers.
const conn = st.s0;
const errorMarginMS = 5000;
const startupRefreshIntervalRelaxedMS = startupRefreshIntervalMS + errorMarginMS;
- let expectedParams =
- Object.fromEntries(kAllClusterParameterDefaults.map(elem => [elem._id, elem]));
- function expectedParamsAsArray() {
- return Object.values(expectedParams);
- }
-
checkLog.containsRelaxedJson(
conn,
6226403,
{clusterParameterDocuments: [{"tenantId": "none", "updatedParameters": []}]},
1,
startupRefreshIntervalRelaxedMS);
- runGetClusterParameterSharded(st, '*', expectedParamsAsArray());
// Set a cluster parameter to a different value and then wait.
assert.commandWorked(
conn.adminCommand({setClusterParameter: {testIntClusterParameter: {intData: 2022}}}));
- expectedParams.testIntClusterParameter.intData = 2022;
// Check that the newly set parameter is refreshed within the interval.
checkLog.containsRelaxedJson(
@@ -54,14 +41,11 @@ function runTest(st, startupRefreshIntervalMS) {
},
1,
startupRefreshIntervalRelaxedMS);
- runGetClusterParameterSharded(st, '*', expectedParamsAsArray());
// Set another cluster parameter and check that only the updated parameter is refreshed within
// the interval.
assert.commandWorked(
conn.adminCommand({setClusterParameter: {testStrClusterParameter: {strData: "welcome"}}}));
- expectedParams.testStrClusterParameter.strData = "welcome";
-
checkLog.containsRelaxedJson(
conn,
6226403,
@@ -73,18 +57,16 @@ function runTest(st, startupRefreshIntervalMS) {
},
1,
startupRefreshIntervalRelaxedMS);
- runGetClusterParameterSharded(st, '*', expectedParamsAsArray());
- // Shorten the refresh interval by error margin + 3 seconds and verify that further
- // setClusterParameter updates are seen within the new interval.
- const newRefreshIntervalMS = startupRefreshIntervalMS - errorMarginMS - 3000;
+ // Shorten the refresh interval by half and verify that the next setClusterParameter update
+ // is seen within the new interval.
+ const newRefreshIntervalMS = startupRefreshIntervalMS / 2;
+ const newRefreshIntervalSecs = newRefreshIntervalMS / 1000;
const newRefreshIntervalRelaxedMS = newRefreshIntervalMS + errorMarginMS;
assert.commandWorked(conn.adminCommand(
- {setParameter: 1, clusterServerParameterRefreshIntervalSecs: newRefreshIntervalMS / 1000}));
+ {setParameter: 1, clusterServerParameterRefreshIntervalSecs: newRefreshIntervalSecs}));
assert.commandWorked(
conn.adminCommand({setClusterParameter: {testIntClusterParameter: {intData: 2025}}}));
- expectedParams.testIntClusterParameter.intData = 2025;
-
checkLog.containsRelaxedJson(
conn,
6226403,
@@ -96,7 +78,6 @@ function runTest(st, startupRefreshIntervalMS) {
},
1,
newRefreshIntervalRelaxedMS);
- runGetClusterParameterSharded(st, '*', expectedParamsAsArray());
// Restart the mongos and check that it refreshes both of the parameters that have documents on
// the config server.
@@ -114,14 +95,11 @@ function runTest(st, startupRefreshIntervalMS) {
},
1,
newRefreshIntervalRelaxedMS);
- runGetClusterParameterSharded(st, '*', expectedParamsAsArray());
// Check that single parameter updates are caught as expected after restart. Note that the
// startup refresh interval is used since runtime setParameter updates are not persisted.
assert.commandWorked(
conn.adminCommand({setClusterParameter: {testStrClusterParameter: {strData: "goodbye"}}}));
- expectedParams.testStrClusterParameter.strData = "goodbye";
-
checkLog.containsRelaxedJson(
conn,
6226403,
@@ -133,7 +111,6 @@ function runTest(st, startupRefreshIntervalMS) {
},
1,
startupRefreshIntervalRelaxedMS);
- runGetClusterParameterSharded(st, '*', expectedParamsAsArray());
// Finally, check that multiple setClusterParameter invocations within a single refresh cycle
// are captured and updated.
@@ -141,27 +118,22 @@ function runTest(st, startupRefreshIntervalMS) {
conn.adminCommand({setClusterParameter: {testIntClusterParameter: {intData: 2028}}}));
assert.commandWorked(
conn.adminCommand({setClusterParameter: {testBoolClusterParameter: {boolData: true}}}));
- expectedParams.testIntClusterParameter.intData = 2028;
- expectedParams.testBoolClusterParameter.boolData = true;
-
checkLog.containsRelaxedJson(conn,
6226403,
{
clusterParameterDocuments: [{
"tenantId": "none",
"updatedParameters": [
- {_id: "testIntClusterParameter", intData: 2028},
- {_id: "testBoolClusterParameter", boolData: true}
-
+ {_id: "testBoolClusterParameter", boolData: true},
+ {_id: "testIntClusterParameter", intData: 2028}
]
}]
},
1,
startupRefreshIntervalRelaxedMS);
- runGetClusterParameterSharded(st, '*', expectedParamsAsArray());
}
-// Test with shortened clusterServerParameterRefreshIntervalSecs at startup.
+// Test with default clusterServerParameterRefreshIntervalSecs at startup.
let options = {
mongos: 1,
config: 1,
@@ -172,11 +144,29 @@ let options = {
mongosOptions: {
setParameter: {
logLevel: 3,
- clusterServerParameterRefreshIntervalSecs: 10,
},
},
};
let st = new ShardingTest(options);
-runTest(st, 10000);
+runTest(st, 30000);
+st.stop();
+
+// Test with non-default clusterServerParameterRefreshIntervalSecs at startup.
+options = {
+ mongos: 1,
+ config: 1,
+ shards: 3,
+ rs: {
+ nodes: 3,
+ },
+ mongosOptions: {
+ setParameter: {
+ logLevel: 3,
+ clusterServerParameterRefreshIntervalSecs: 20,
+ },
+ },
+};
+st = new ShardingTest(options);
+runTest(st, 20000);
st.stop();
})();