summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/hooks/run_inject_hello_failures.js5
-rw-r--r--jstests/noPassthrough/set_step_params.js20
-rw-r--r--src/mongo/db/repl/replication_info.cpp12
3 files changed, 26 insertions, 11 deletions
diff --git a/jstests/hooks/run_inject_hello_failures.js b/jstests/hooks/run_inject_hello_failures.js
index 57d38dbe1f9..0d5621077d8 100644
--- a/jstests/hooks/run_inject_hello_failures.js
+++ b/jstests/hooks/run_inject_hello_failures.js
@@ -79,7 +79,10 @@ function injectHelloFail(connection) {
assert.commandWorked(adminDB.runCommand({
configureFailPoint: 'waitInHello',
mode: "alwaysOn",
- data: {internalClient: 1} // No effect if client is mongo shell.
+ data: {
+ internalClient: 1, // No effect if client is mongo shell.
+ delay: kInjectedHelloDelayMs
+ }
}));
const res = adminDB.runCommand({getParameter: 1, "failpoint.waitInHello": 1});
assert.commandWorked(res);
diff --git a/jstests/noPassthrough/set_step_params.js b/jstests/noPassthrough/set_step_params.js
index cb532bdb9eb..6720716eb27 100644
--- a/jstests/noPassthrough/set_step_params.js
+++ b/jstests/noPassthrough/set_step_params.js
@@ -35,15 +35,19 @@ const allHosts = cfg.members.map(x => x.host);
const mongosDB = mongos.getDB(kDbName);
const primaryOnly = [primary.name];
-function configureReplSetFailpoint(name, modeValue) {
+function configureReplSetFailpoint(name, modeValue, extraData = undefined) {
+ let data = {
+ shouldCheckForInterrupt: true,
+ nss: kDbName + ".test",
+ };
+ if (extraData) {
+ data = Object.assign({}, data, extraData);
+ }
st.rs0.nodes.forEach(function(node) {
assert.commandWorked(node.getDB("admin").runCommand({
configureFailPoint: name,
mode: modeValue,
- data: {
- shouldCheckForInterrupt: true,
- nss: kDbName + ".test",
- },
+ data: data,
}));
});
}
@@ -85,7 +89,7 @@ function hasConnPoolStats(args) {
function checkStats(res, host) {
var stats = res.hosts[host];
if (!stats) {
- jsTestLog("Connection stats for " + host + " are absent");
+ jsTestLog("Connection stats for " + host + " are absent in: " + tojson(res));
return isAbsent;
}
@@ -184,7 +188,7 @@ runSubTest("MaxConnecting", function() {
ShardingTaskExecutorPoolMaxConnecting: maxPending1,
});
- configureReplSetFailpoint("waitInHello", "alwaysOn");
+ configureReplSetFailpoint("waitInHello", "alwaysOn", {delay: 10000});
configureReplSetFailpoint("waitInFindBeforeMakingBatch", "alwaysOn");
dropConnections();
@@ -242,7 +246,7 @@ runSubTest("Timeouts", function() {
hasConnPoolStats({ready: conns});
// Block refreshes and wait for the toRefresh timeout
- configureReplSetFailpoint("waitInHello", "alwaysOn");
+ configureReplSetFailpoint("waitInHello", "alwaysOn", {delay: 100000});
sleep(toRefreshTimeoutMS);
// Confirm that we're in pending for all of our conns
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index ab92c1208ae..73479822d21 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -250,7 +250,7 @@ boost::optional<Milliseconds> handleHelloFailPoint(const BSONObj& args, const BS
// Sleep implementation outside the fail point handler itself to avoid the problem that
// processing a fail point will block its state.
-void sleepForDurationOrUntilShutdown(Milliseconds sleep) {
+void sleepHelloForDurationOrUntilShutdown(Milliseconds sleep) {
while (sleep > Milliseconds(0) && !globalInShutdownDeprecated()) {
auto nextSleep = std::min(sleep, Milliseconds(1000));
try {
@@ -259,6 +259,14 @@ void sleepForDurationOrUntilShutdown(Milliseconds sleep) {
} catch (...) {
break;
}
+ bool stillEnabled = false;
+ MONGO_FAIL_POINT_BLOCK(waitInHello, customArgs) {
+ stillEnabled = true;
+ }
+ if (!stillEnabled) {
+ log() << "Fail point Hello was turned off";
+ break;
+ }
}
}
@@ -298,7 +306,7 @@ public:
sleepTimeout = handleHelloFailPoint(customArgs.getData(), cmdObj);
}
if (MONGO_unlikely(sleepTimeout)) {
- sleepForDurationOrUntilShutdown(*sleepTimeout);
+ sleepHelloForDurationOrUntilShutdown(*sleepTimeout);
}
/* currently request to arbiter is (somewhat arbitrarily) an ismaster request that is not