summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2016-02-07 14:12:06 -0500
committermatt dannenberg <matt.dannenberg@10gen.com>2016-02-08 16:53:22 -0500
commitbb591bb00db62498ac1fb7d42d9f223da8daa0ac (patch)
tree51e5651d87276ece2810545a0e44223bd32c2374
parent9145945c9311f6070b97ee9b8443ef6ec35274d4 (diff)
downloadmongo-bb591bb00db62498ac1fb7d42d9f223da8daa0ac.tar.gz
SERVER-22504 do not add self to _hbdata when removed from the set
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
index fc2cbcde928..d068b8f1bb4 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
@@ -520,8 +520,11 @@ void ReplicationCoordinatorImpl::_heartbeatReconfigFinish(
myIndex = StatusWith<int>(-1);
}
const ReplicaSetConfig oldConfig = _rsConfig;
+ // If we do not have an index, we should pass -1 as our index to avoid falsely adding ourself to
+ // the data structures inside of the TopologyCoordinator.
+ const int myIndexValue = myIndex.getStatus().isOK() ? myIndex.getValue() : -1;
const PostMemberStateUpdateAction action =
- _setCurrentRSConfig_inlock(cbData, newConfig, myIndex.getValue());
+ _setCurrentRSConfig_inlock(cbData, newConfig, myIndexValue);
lk.unlock();
_resetElectionInfoOnProtocolVersionUpgrade(oldConfig, newConfig);
_performPostMemberStateUpdateAction(action);