[JAVA-1158] For direct connection, ignore read preference when selecting a server Created: 01/Apr/14  Updated: 03/Apr/14  Resolved: 02/Apr/14

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: None
Fix Version/s: 2.12.0

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: final
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The 2.12 release candidate contains an inadvertent change to the behavior of a direct connection (ones where only a single server address is provided, rather than a List<ServerAddress>) to a member of a replica set: it takes in to consideration the read preference when determining if an operation will be sent to the server that its directly connected to.

This, if the read preference is secondary and its directly connected to a primary, the operation will fail. Similarly, if the read preference is primary and its directly connected to a secondary, the operation will fail.

Though there a a good argument to be made that it's the correct behavior, this change should be backed out, as it's inconsistent with the current behavior of most other drivers.



 Comments   
Comment by Githook User [ 01/Apr/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1158: No longer apply read preference server selection logic to direct connections, and in general only use
the set of server selectors that make sense for the connection mode and cluster type
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/b9e793efa1549243503dd4713e705e1d6e1d0407

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