summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/free_mon/free_mon_processor.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/free_mon/free_mon_processor.cpp b/src/mongo/db/free_mon/free_mon_processor.cpp
index e305089bf9c..144b8fe5325 100644
--- a/src/mongo/db/free_mon/free_mon_processor.cpp
+++ b/src/mongo/db/free_mon/free_mon_processor.cpp
@@ -349,12 +349,17 @@ void FreeMonProcessor::doServerRegister(
if (!state.is_initialized()) {
_registerOnTransitionToPrimary = regType;
} else {
- // We are standalone, if we have a registration id, then send a registration
- // notification, else wait for the user to register us
+ // We are standalone or secondary, if we have a registration id, then send a
+ // registration notification, else wait for the user to register us.
if (state.get().getState() == StorageStateEnum::enabled) {
enqueue(FreeMonRegisterCommandMessage::createNow(msg->getPayload().second));
}
}
+
+ // Ensure we read the state once.
+ // This is important on a disabled secondary so that the in-memory state knows we are
+ // disabled.
+ readState(optCtx.get());
}
}