diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-10-12 10:22:19 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-10-12 10:22:19 -0400 |
commit | 8ea06cd353ec362256dfcafa835ceba78ecc8186 (patch) | |
tree | ccfb8e8a64b0b3a532a6022bb40111c32800e8d5 | |
parent | 72cc3481b9e9ec791365b8ba6c183945e8093147 (diff) | |
download | mongo-8ea06cd353ec362256dfcafa835ceba78ecc8186.tar.gz |
backport of 8e42151eccd3766bd0ad0320340d930ad0cc54ed for SERVER-6463
-rw-r--r-- | client/dbclient_rs.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client/dbclient_rs.cpp b/client/dbclient_rs.cpp index be66bb451c4..b1f80670e78 100644 --- a/client/dbclient_rs.cpp +++ b/client/dbclient_rs.cpp @@ -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 ) { |