Permalink
Browse files

backport of 8e42151 for SERVER-6463

  • Loading branch information...
1 parent 72cc348 commit 8ea06cd353ec362256dfcafa835ceba78ecc8186 @erh erh committed Oct 12, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 client/dbclient_rs.cpp
View
@@ -405,7 +405,7 @@ namespace mongo {
break;
}
- return changed || origHosts != numHosts;
+ return (changed || origHosts != numHosts) && numHosts > 0;
}
@@ -530,6 +530,13 @@ namespace mongo {
log( ! verbose ) << "ReplicaSetMonitor::_checkConnection: " << conn->toString()
<< ' ' << o << endl;
+ if (!o["secondary"].trueValue() && !o["ismaster"].trueValue()) {
+ /* This node is not in steady state so don't trust the host list.
+ * In the worst case, this node can even be a non member of the set.
+ */
+ return false;
+ }
+
// add other nodes
BSONArrayBuilder b;
if ( o["hosts"].type() == Array ) {

0 comments on commit 8ea06cd

Please sign in to comment.