diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2019-04-05 15:49:09 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2019-04-05 15:50:14 -0400 |
commit | b5883226855662d54f990ebb7dcfd952c037a11c (patch) | |
tree | d0d4064f4634298b321cffd00c3009dfc1a40b99 /src/mongo | |
parent | fc47f37ed80a2ec3ee36939eb164fe0d1c65bb80 (diff) | |
download | mongo-b5883226855662d54f990ebb7dcfd952c037a11c.tar.gz |
SERVER-40112 db.disableFreeMonitoring() returns 'not master' on secondary after restart
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/free_mon/free_mon_processor.cpp | 9 |
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()); } } |