[JAVA-225] Read against dead replica slave doesn't fail over correctly when there is no master Created: 02/Dec/10  Updated: 22/Dec/10  Resolved: 07/Dec/10

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: 2.3
Fix Version/s: 2.4

Type: Bug Priority: Blocker - P1
Reporter: Daniel Rinehart Assignee: Antoine Girbal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

We always want reads against Mongo to succeed if there is at least one standard or passive node of the replica set alive. However, in DBTCPConnector's call() handling, if an IOException occurs against the chosen DBPort, the logic in _error() that calls checkMaster() will cause an error if the master is also unavailable. This checkMaster() needs to be conditional based on slaveOk being set. That is, if slaveOk is true in the call() method the check should be checkMaster(true, false) so that the list of hosts is refreshed even if it results in no master being found.



 Comments   
Comment by Antoine Girbal [ 07/Dec/10 ]

thanks for the report, this is a problematic bug.
I confirmed and fixed both issues in trunk.

Comment by auto [ 07/Dec/10 ]

Author:

{'login': 'agirbal', 'name': 'agirbal', 'email': 'antoine@10gen.com'}

Message: JAVA-225: Read against dead replica slave doesn't fail over correctly when there is no master
/mongodb/mongo-java-driver/commit/157552d5664a19417d0a947187135d3738377a92

Comment by Chris Tierney [ 03/Dec/10 ]

There is an additional problem with call(); even before it attempts to connect it calls checkMaster( false , true ), which could also result in an error if there is no master available.

Generated at Thu Feb 08 08:51:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.