[SERVER-13660] Better Error Response from Shard with No Primary Created: 18/Apr/14  Updated: 06/Dec/22  Resolved: 05/Nov/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Doug Jones Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Done Votes: 0
Labels: ShardingRoughEdges, lamont-triage, nc
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-1118 Mongo Java Driver Descriptive Excepti... Closed
Assigned Teams:
Sharding
Participants:

 Description   

This comes out of the discussion on JAVA-1118.

Improve (ie: more descriptive and unique) error type/code/message response when a shard is unable to serve a query due to a read preference mismatch.

For instance, in the Java driver 2.12.0, in the case of a mismatch (such as primary requested but only secondaries are available), the driver will throw an exception with type MongoServerSelectionException rather than a generic exception. However, in a sharded environment, according to my testing and what Jeff has mentioned in JAVA-1118 the mongo server (or mongos) doesn't return enough information and the driver is forced to throw a generic exception in this case.

It would be great if the specifics of this error could be passed in the response to the driver so a specific exception can be thrown at this level.



 Comments   
Comment by Kaloian Manassiev [ 03/Jan/19 ]

I am pretty sure we should be throwing FailedToSatisfyReadPreference exception in these cases, but flagging it for triage so that someone can validate this and possibly write a test.

Generated at Thu Feb 08 03:32:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.