summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2015-02-09 16:45:18 -0500
committerRandolph Tan <randolph@10gen.com>2015-02-10 15:23:52 -0500
commit224067d03b7631d4c984fe99cccda3a0d2f6874c (patch)
treeb7d5af0e15d8ffc7e40794723d29d4e2c288319b
parent6d981db23d9ec7cdbfc3cbce8d6323ec0b6be816 (diff)
downloadmongo-224067d03b7631d4c984fe99cccda3a0d2f6874c.tar.gz
SERVER-10904 Possible for _master and _slaveConn to be pointing to different connections
-rw-r--r--src/mongo/client/dbclient_rs.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp
index 9311bf3d76b..ec20b9fcd0f 100644
--- a/src/mongo/client/dbclient_rs.cpp
+++ b/src/mongo/client/dbclient_rs.cpp
@@ -339,6 +339,12 @@ namespace {
return false;
}
+ // If _lastSlaveOkConn is pointing to a connection to primary, make sure that it is
+ // the same as _master, as this is the connection that has the version set.
+ if (_lastSlaveOkHost == _masterHost) {
+ _lastSlaveOkConn = _master;
+ }
+
// Make sure we don't think the host is down.
if (_lastSlaveOkConn->isFailed() || !_getMonitor()->isHostUp(_lastSlaveOkHost)) {
invalidateLastSlaveOkCache();