Skip to content

Commit

Permalink
SERVER-19876 In ReplicaSetMonitor, consider host lists provided by RS…
Browse files Browse the repository at this point in the history
…Ghost nodes when appropriate.

A ReplicaSetMonitor that has not yet found the primary node for its set should
consider the host list provided by ghost nodes (i.e., nodes in state REMOVED and
nodes that are shutting down) when trying to find replica set members.
  • Loading branch information
amschwerin committed Aug 14, 2015
1 parent 958cc2c commit 0e588cc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/mongo/client/replica_set_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,19 @@ void Refresher::receivedIsMaster(const HostAndPort& from,
}

if (reply.setName != _set->name) {
warning() << "node: " << from << " isn't a part of set: " << _set->name
<< " ismaster: " << replyObj;
if (reply.raw["isreplicaset"].trueValue()) {
// The reply came from a node in the state referred to as RSGhost in the SDAM
// spec. RSGhost corresponds to either REMOVED or STARTUP member states. In any event,
// if a reply from a ghost offers a list of possible other members of the replica set,
// and if this refresher has yet to find the replica set master, we add hosts listed in
// the reply to the list of possible replica set members.
if (!_scan->foundUpMaster) {
_scan->possibleNodes.insert(reply.normalHosts.begin(), reply.normalHosts.end());
}
} else {
warning() << "node: " << from << " isn't a part of set: " << _set->name
<< " ismaster: " << replyObj;
}
failedHost(from);
return;
}
Expand Down

0 comments on commit 0e588cc

Please sign in to comment.