Skip to content

Commit 53ac03e

Browse files
gracicotMongoDB Bot
authored and
MongoDB Bot
committedOct 1, 2024
SERVER-78880 Remove special version-handling of routerWaitInHello and shardWaitInHello (#27488)
GitOrigin-RevId: 278571b2acf2ab45b1de3dfe6a232b7dd930871e
1 parent 50dcd81 commit 53ac03e

9 files changed

+26
-70
lines changed
 

‎jstests/hooks/run_cleanup_hello_failures.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import {DiscoverTopology, Topology} from "jstests/libs/discover_topology.js";
2-
import {getFailPointName} from "jstests/libs/fail_point_util.js";
32
import {FixtureHelpers} from "jstests/libs/fixture_helpers.js";
43

54
function cleanupHelloFailInjection(connection) {
65
jsTestLog(`Cleanup Hello fail injection in ${connection}`);
76
let adminDB = connection.getDB('admin');
8-
const fpName = getFailPointName("shardWaitInHello", connection.getMaxWireVersion());
9-
assert.commandWorked(adminDB.runCommand({configureFailPoint: fpName, mode: "off"}));
10-
const prefixedName = `failpoint.${fpName}`;
11-
const res = assert.commandWorked(adminDB.runCommand({getParameter: 1, [prefixedName]: 1}));
12-
assert.eq(res[`failpoint.${fpName}`].mode, 0);
7+
assert.commandWorked(adminDB.runCommand({configureFailPoint: "shardWaitInHello", mode: "off"}));
8+
const res = assert.commandWorked(
9+
adminDB.runCommand({getParameter: 1, "failpoint.shardWaitInHello": 1}));
10+
assert.eq(res[`failpoint.shardWaitInHello`].mode, 0);
1311
}
1412

1513
function doFailInjectionCleanup(db) {

‎jstests/hooks/run_inject_hello_failures.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {getFailPointName} from "jstests/libs/fail_point_util.js";
2-
31
// Interval between test loops.
42
const kTestLoopPeriodMs = 20 * 1000;
53

@@ -76,16 +74,14 @@ function injectReduceRefreshPeriod(connection) {
7674
function injectHelloFail(connection) {
7775
jsTestLog(`Inject Hello fail to connection ${connection}`);
7876
const adminDB = getAdminDB(connection);
79-
const fpName = getFailPointName("shardWaitInHello", connection.getMaxWireVersion());
8077
assert.commandWorked(adminDB.runCommand({
81-
configureFailPoint: fpName,
78+
configureFailPoint: "shardWaitInHello",
8279
mode: "alwaysOn",
8380
data: {internalClient: 1} // No effect if client is mongo shell.
8481
}));
85-
const prefixedName = `failpoint.${fpName}`;
86-
const res = adminDB.runCommand({getParameter: 1, [prefixedName]: 1});
82+
const res = adminDB.runCommand({getParameter: 1, "failpoint.shardWaitInHello": 1});
8783
assert.commandWorked(res);
88-
assert.eq(res[`failpoint.${fpName}`].mode, 1);
84+
assert.eq(res["failpoint.shardWaitInHello"].mode, 1);
8985
}
9086

9187
function freeze(connection) {

‎jstests/libs/fail_point_util.js

-29
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ export var configureFailPoint;
99
export var configureFailPointForRS;
1010
export var kDefaultWaitForFailPointTimeout;
1111

12-
/**
13-
* Utility to get the correct name of a fail point given the name of the fail point on the main
14-
* branch and the wire-version of the server you are speaking to.
15-
*/
16-
export var getFailPointName;
17-
1812
(function() {
1913
if (configureFailPoint) {
2014
return; // Protect against this file being double-loaded.
@@ -127,27 +121,4 @@ configureFailPointForRS = function(conns, failPointName, data = {}, failPointMod
127121
}
128122
};
129123
};
130-
131-
// Add an entry to this map if you are changing the name of an existing fail point.
132-
// Key is name of the failpoint on master. Value is a function taking wireVersion
133-
// that returns the correct name of the fail point on that wireVersion.
134-
const kWireVersion73 = 24;
135-
const failPointRenameTable = {
136-
"routerWaitInHello": function(wireVersion) {
137-
if (wireVersion >= kWireVersion73) {
138-
return "routerWaitInHello";
139-
}
140-
return "waitInHello";
141-
},
142-
"shardWaitInHello": function(wireVersion) {
143-
if (wireVersion >= kWireVersion73) {
144-
return "shardWaitInHello";
145-
}
146-
return "waitInHello";
147-
}
148-
};
149-
150-
getFailPointName = function(failPointNameOnMain, wireVersion) {
151-
return failPointRenameTable[failPointNameOnMain](wireVersion);
152-
};
153124
})();

‎jstests/noPassthrough/architecture/set_step_params.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import {assertHasConnPoolStats, launchFinds} from "jstests/libs/conn_pool_helpers.js";
6-
import {configureFailPointForRS, getFailPointName} from "jstests/libs/fail_point_util.js";
6+
import {configureFailPointForRS} from "jstests/libs/fail_point_util.js";
77
import {ShardingTest} from "jstests/libs/shardingtest.js";
88

99
const kDbName = 'test';
@@ -33,7 +33,6 @@ const cfg = primary.getDB('local').system.replset.findOne();
3333
const allHosts = cfg.members.map(x => x.host);
3434
const mongosDB = mongos.getDB(kDbName);
3535
const primaryOnly = [primary.name];
36-
const waitInHelloFpName = getFailPointName("shardWaitInHello", mongos.getMaxWireVersion());
3736

3837
var threads = [];
3938
var currentCheckNum = 0;
@@ -133,7 +132,7 @@ runSubTest("MaxConnecting", function() {
133132
"waitInFindBeforeMakingBatch",
134133
{shouldCheckForInterrupt: true, nss: kDbName + ".test"});
135134
const fpHelloRs =
136-
configureFailPointForRS(st.rs0.nodes, waitInHelloFpName, {shouldCheckForInterrupt: true});
135+
configureFailPointForRS(st.rs0.nodes, "shardWaitInHello", {shouldCheckForInterrupt: true});
137136
dropConnections();
138137

139138
// Go to the limit of maxConnecting, so we're stuck here
@@ -202,7 +201,7 @@ runSubTest("Timeouts", function() {
202201

203202
// Block refreshes and wait for the toRefresh timeout
204203
const fpHelloRs =
205-
configureFailPointForRS(st.rs0.nodes, waitInHelloFpName, {shouldCheckForInterrupt: true});
204+
configureFailPointForRS(st.rs0.nodes, "shardWaitInHello", {shouldCheckForInterrupt: true});
206205
sleep(toRefreshTimeoutMS);
207206

208207
// Confirm that we're in pending for all of our conns

‎jstests/noPassthrough/replication/awaitable_hello.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* isMaster and ismaster.
44
* @tags: [requires_replication]
55
*/
6-
import {configureFailPoint, getFailPointName} from "jstests/libs/fail_point_util.js";
6+
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
77
import {funWithArgs} from "jstests/libs/parallel_shell_helpers.js";
88
import {ReplSetTest} from "jstests/libs/replsettest.js";
99
import {ShardingTest} from "jstests/libs/shardingtest.js";
@@ -200,27 +200,26 @@ function runTest(db, cmd, logFailpoint, failpointName) {
200200

201201
// Set command log verbosity to 0 to avoid logging *all* commands in the "slow query" log.
202202
const conn = MongoRunner.runMongod({setParameter: {logComponentVerbosity: tojson({command: 0})}});
203-
const shardWaitInHello = getFailPointName("shardWaitInHello", conn.getMaxWireVersion());
204203
assert.neq(null, conn, "mongod was unable to start up");
205-
runTest(conn.getDB("admin"), "hello", "waitForHelloCommandLogged", shardWaitInHello);
206-
runTest(conn.getDB("admin"), "isMaster", "waitForIsMasterCommandLogged", shardWaitInHello);
207-
runTest(conn.getDB("admin"), "ismaster", "waitForIsMasterCommandLogged", shardWaitInHello);
204+
runTest(conn.getDB("admin"), "hello", "waitForHelloCommandLogged", "shardWaitInHello");
205+
runTest(conn.getDB("admin"), "isMaster", "waitForIsMasterCommandLogged", "shardWaitInHello");
206+
runTest(conn.getDB("admin"), "ismaster", "waitForIsMasterCommandLogged", "shardWaitInHello");
208207
MongoRunner.stopMongod(conn);
209208

210209
const replTest = new ReplSetTest(
211210
{nodes: 1, nodeOptions: {setParameter: {logComponentVerbosity: tojson({command: 0})}}});
212211
replTest.startSet();
213212
replTest.initiate();
214213
runTest(
215-
replTest.getPrimary().getDB("admin"), "hello", "waitForHelloCommandLogged", shardWaitInHello);
214+
replTest.getPrimary().getDB("admin"), "hello", "waitForHelloCommandLogged", "shardWaitInHello");
216215
runTest(replTest.getPrimary().getDB("admin"),
217216
"isMaster",
218217
"waitForIsMasterCommandLogged",
219-
shardWaitInHello);
218+
"shardWaitInHello");
220219
runTest(replTest.getPrimary().getDB("admin"),
221220
"ismaster",
222221
"waitForIsMasterCommandLogged",
223-
shardWaitInHello);
222+
"shardWaitInHello");
224223
replTest.stopSet();
225224

226225
const st = new ShardingTest({
@@ -229,8 +228,7 @@ const st = new ShardingTest({
229228
config: 1,
230229
other: {mongosOptions: {setParameter: {logComponentVerbosity: tojson({command: 0})}}}
231230
});
232-
const fpName = getFailPointName("routerWaitInHello", st.s.getMaxWireVersion());
233-
runTest(st.s.getDB("admin"), "hello", "waitForHelloCommandLogged", fpName);
234-
runTest(st.s.getDB("admin"), "isMaster", "waitForIsMasterCommandLogged", fpName);
235-
runTest(st.s.getDB("admin"), "ismaster", "waitForIsMasterCommandLogged", fpName);
231+
runTest(st.s.getDB("admin"), "hello", "waitForHelloCommandLogged", "routerWaitInHello");
232+
runTest(st.s.getDB("admin"), "isMaster", "waitForIsMasterCommandLogged", "routerWaitInHello");
233+
runTest(st.s.getDB("admin"), "ismaster", "waitForIsMasterCommandLogged", "routerWaitInHello");
236234
st.stop();

‎jstests/noPassthrough/replication/waitInHello_failpoint.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Tests the shardWaitInHello and routerWaitInHello failpoints.
22
// @tags: [requires_replication]
33
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
4-
import {getFailPointName} from "jstests/libs/fail_point_util.js";
54
import {ReplSetTest} from "jstests/libs/replsettest.js";
65
import {ShardingTest} from "jstests/libs/shardingtest.js";
76

@@ -31,16 +30,15 @@ function runTest(conn, fpName) {
3130

3231
const standalone = MongoRunner.runMongod({});
3332
assert.neq(null, standalone, "mongod was unable to start up");
34-
runTest(standalone, getFailPointName("shardWaitInHello", standalone.getMaxWireVersion()));
33+
runTest(standalone, "shardWaitInHello");
3534
MongoRunner.stopMongod(standalone);
3635

3736
const rst = new ReplSetTest({nodes: 1});
3837
rst.startSet();
3938
rst.initiate();
40-
runTest(rst.getPrimary(),
41-
getFailPointName("shardWaitInHello", rst.getPrimary().getMaxWireVersion()));
39+
runTest(rst.getPrimary(), "shardWaitInHello");
4240
rst.stopSet();
4341

4442
const st = new ShardingTest({mongos: 1, shards: [{nodes: 1}], config: 1});
45-
runTest(st.s, getFailPointName("routerWaitInHello", st.s.getMaxWireVersion()));
43+
runTest(st.s, "routerWaitInHello");
4644
st.stop();

‎jstests/noPassthroughWithMongod/ingress_handshake_and_auth_metrics.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*
44
* @tags: [requires_fcv_70]
55
*/
6-
import {getFailPointName} from "jstests/libs/fail_point_util.js";
76
import {ingressHandshakeMetricsTest} from "jstests/libs/ingress_handshake_metrics_helpers.js";
87

98
let runTest = (connectionHealthLoggingOn) => {
@@ -18,7 +17,7 @@ let runTest = (connectionHealthLoggingOn) => {
1817
helloProcessingDelayMillis: 50,
1918
helloResponseDelayMillis: 100,
2019
rootCredentials: rootCreds,
21-
helloFailPointName: getFailPointName("shardWaitInHello", conn.getMaxWireVersion()),
20+
helloFailPointName: "shardWaitInHello",
2221
});
2322

2423
jsTestLog("Connecting to mongod and running the test.");

‎jstests/sharding/awaitable_hello_primary_failures.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ TestData.skipCheckShardFilteringMetadata = true;
1616

1717
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
1818
import {awaitRSClientHosts} from "jstests/replsets/rslib.js";
19-
import {getFailPointName} from "jstests/libs/fail_point_util.js";
2019
import {ShardingTest} from "jstests/libs/shardingtest.js";
2120

2221
let st = new ShardingTest({shards: {rs0: {nodes: 1}}});
@@ -29,8 +28,7 @@ awaitRSClientHosts(mongos, {host: rsPrimary.name}, {ok: true, ismaster: true});
2928
// Turn on the shardWaitInHello failpoint. This will cause the primary node to cease sending "hello"
3029
// responses and the RSM should mark the node as down
3130
jsTestLog("Turning on shardWaitInHello failpoint. Node should stop sending hello responses.");
32-
const helloFailpoint = configureFailPoint(
33-
rsPrimary, getFailPointName("shardWaitInHello", rsPrimary.getMaxWireVersion()));
31+
const helloFailpoint = configureFailPoint(rsPrimary, "shardWaitInHello");
3432
awaitRSClientHosts(mongos, {host: rsPrimary.name}, {ok: false, ismaster: false});
3533
helloFailpoint.off();
3634

‎jstests/sharding/ingress_handshake_and_auth_metrics_mongos.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* embedded_router_incompatible,
99
* ]
1010
*/
11-
import {getFailPointName} from "jstests/libs/fail_point_util.js";
1211
import {ingressHandshakeMetricsTest} from "jstests/libs/ingress_handshake_metrics_helpers.js";
1312
import {ShardingTest} from "jstests/libs/shardingtest.js";
1413

@@ -23,7 +22,7 @@ let runTest = (connectionHealthLoggingOn) => {
2322
postAuthDelayMillis: 100,
2423
helloProcessingDelayMillis: 50,
2524
helloResponseDelayMillis: 100,
26-
helloFailPointName: getFailPointName("routerWaitInHello", conn.getMaxWireVersion()),
25+
helloFailPointName: "routerWaitInHello",
2726
});
2827

2928
jsTestLog("Connecting to mongos and running the test.");

0 commit comments

Comments
 (0)