summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/shutdown_d.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/commands/shutdown_d.cpp b/src/mongo/db/commands/shutdown_d.cpp
index bed8d258d0a..157ff7b7fa9 100644
--- a/src/mongo/db/commands/shutdown_d.cpp
+++ b/src/mongo/db/commands/shutdown_d.cpp
@@ -40,6 +40,10 @@
namespace mongo {
+namespace {
+MONGO_FAIL_POINT_DEFINE(hangInShutdownBeforeStepdown);
+} // namespace
+
Status stepDownForShutdown(OperationContext* opCtx,
const Milliseconds& waitTime,
bool forceShutdown) noexcept {
@@ -48,6 +52,11 @@ Status stepDownForShutdown(OperationContext* opCtx,
// for any secondaries. Ignore stepdown.
if (replCoord->getConfig().getNumMembers() != 1) {
try {
+ if (MONGO_FAIL_POINT(hangInShutdownBeforeStepdown)) {
+ log() << "hangInShutdownBeforeStepdown failpoint enabled";
+ MONGO_FAIL_POINT_PAUSE_WHILE_SET(hangInShutdownBeforeStepdown);
+ }
+
replCoord->stepDown(opCtx, false /* force */, waitTime, Seconds(120));
} catch (const ExceptionFor<ErrorCodes::NotWritablePrimary>&) {
// Ignore NotWritablePrimary errors.