Permalink
Browse files

JAVA-680: Fixing a regression introduced in the previous commit for t…

…his issue. In the case where the driver

is not connected to a replica set, like in mongos HA, still may need to ensure there is a master
  • Loading branch information...
1 parent dc952e2 commit af8066db002fea54854fe96bb240bb7b7501fb96 @jyemin jyemin committed Oct 25, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/main/com/mongodb/DBTCPConnector.java
View
3 src/main/com/mongodb/DBTCPConnector.java
@@ -272,7 +272,8 @@ private Response innerCall(final DB db, final DBCollection coll, final OutMessag
boolean secondaryOk = !(readPref == ReadPreference.primary());
_checkClosed();
- if (!secondaryOk)
+ // Don't check master on secondary reads unless connected to a replica set
+ if (!secondaryOk || getReplicaSetStatus() == null)
checkMaster( false, !secondaryOk );
final MyPort mp = _myPort.get();

0 comments on commit af8066d

Please sign in to comment.