Skip to content

Commit af8066d

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 dc952e2 commit af8066d

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
@@ -272,7 +272,8 @@ private Response innerCall(final DB db, final DBCollection coll, final OutMessag
272272
boolean secondaryOk = !(readPref == ReadPreference.primary());
273273

274274
_checkClosed();
275-
if (!secondaryOk)
275+
// Don't check master on secondary reads unless connected to a replica set
276+
if (!secondaryOk || getReplicaSetStatus() == null)
276277
checkMaster( false, !secondaryOk );
277278

278279
final MyPort mp = _myPort.get();

0 commit comments

Comments
 (0)