[JAVA-2301] Allow application to get db/collection/index list with any ReadPreferences Created: 07/Sep/16  Updated: 16/Sep/16  Resolved: 16/Sep/16

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 3.2.0, 3.3.0
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Tug Grall Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Any



 Description   

It is very common to use Secondary nodes to do some analytics jobs, and it is working perfectly with common query, since it is possible to use a readPreference (from the client or during a call)

However the MongClient, MongoDatabase, and MongoCollection force a ReadPreference.primary() when listing schema information.

This is blocking when the applications only have access to secondary nodes in a replicaset.

We should add the ReadPreference as an optional parameter to schema read/list methods



 Comments   
Comment by Jeffrey Yemin [ 16/Sep/16 ]

Hi Tug,

Closing for now as Works as Designed, but if you have new information we can re-open it.

Regards,
Jeff

Comment by Tug Grall [ 07/Sep/16 ]

I will look into the way my application (Apache Drill) connects to the cluster and be sure that it is using a direct connection when needed. Will come back to here or Drivers when I have more information.

Note that in some of my test, I have only the secondary node running and in this case the operations are failing, since primary is not there at all.

Comment by Jeffrey Yemin [ 07/Sep/16 ]

Hi Tug,

The Java driver is following the server selection specification in its treatment of read preference for these command helpers, so the current behavior is by design. Given that, I'm changing the issue type to New Feature.

A common practice for analytics jobs is to make a direct connection to a (often hidden) secondary member of the replica set to ensure that the job never runs on the primary. In this case, the command helpers will execute on the specified server regardless of the read preference.

If you still feel strongly that the driver behavior should be changed as per your pull request, please open a ticket in the DRIVERSl project, which we use for new feature requests that affect all of the MongoDB drivers.

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