diff options
author | Pavithra Vetriselvan <pavithra.vetriselvan@mongodb.com> | 2020-01-23 20:30:37 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-23 20:30:37 +0000 |
commit | b5070e639428cfcaf6dcb616dc171bf36e45c311 (patch) | |
tree | 69189e2718d7e068a33f20df2a0ee39927d8610a /src/mongo/db/repl | |
parent | 822d13b197ea8bf4e8569f7fc35e7ba871c7424b (diff) | |
download | mongo-b5070e639428cfcaf6dcb616dc171bf36e45c311.tar.gz |
SERVER-45716 protect call to getTerm() with mutex in replSetReconfig command
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index d486e86fdea..5254f100227 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -2742,6 +2742,7 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* opCt makeGuard([&] { lockAndCall(&lk, [=] { _setConfigState_inlock(kConfigSteady); }); }); ReplSetConfig oldConfig = _rsConfig; + auto topCoordTerm = _topCoord->getTerm(); lk.unlock(); ReplSetConfig newConfig; @@ -2755,8 +2756,7 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* opCt // When initializing a new config through the replSetReconfig command, ignore the term // field passed in through its args. Instead, use this node's term. - Status status = - newConfig.initialize(newConfigObj, _topCoord->getTerm(), oldConfig.getReplicaSetId()); + Status status = newConfig.initialize(newConfigObj, topCoordTerm, oldConfig.getReplicaSetId()); if (!status.isOK()) { error() << "replSetReconfig got " << status << " while parsing " << newConfigObj; return Status(ErrorCodes::InvalidReplicaSetConfig, status.reason()); |