summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorAndrew Shuvalov <andrew.shuvalov@mongodb.com>2021-08-21 00:47:39 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-21 01:16:48 +0000
commit3529af5e853b2f13ab34233a561c619b4d1efe22 (patch)
treeeb6a6e095ba47892e7eb9ec385e5c18f7e8a0195 /src/mongo/db/repl
parent18315d2e163ce47d0d7ca7503961c4566e04d70a (diff)
downloadmongo-3529af5e853b2f13ab34233a561c619b4d1efe22.tar.gz
SERVER-59301 fixed waitInHello fail injection and tests using it
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/replication_info.cpp12
1 files changed, 10 insertions, 2 deletions
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