Skip to content

Commit 356a633

Browse files
committed
JAVA-680: Fixing a regression introduced in the previous commit for this 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
1 parent bfbcc0a commit 356a633

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/com/mongodb/DBTCPConnector.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ private Response innerCall(final DB db, final DBCollection coll, final OutMessag
269269
boolean secondaryOk = !(readPref == ReadPreference.primary());
270270

271271
_checkClosed();
272-
if (!secondaryOk)
272+
// Don't check master on secondary reads unless connected to a replica set
273+
if (!secondaryOk || getReplicaSetStatus() == null)
273274
checkMaster( false, !secondaryOk );
274275

275276
final MyPort mp = _myPort.get();

0 commit comments

Comments
 (0)