[SERVER-68440] In server selection, tags are deleted from the ReadPreference if minOpTime is specified and all servers are stale Created: 29/Jul/22  Updated: 18/Jul/23  Resolved: 18/Jul/23

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

Type: Bug Priority: Major - P3
Reporter: Lamont Nelson Assignee: Kruti Shah
Resolution: Duplicate Votes: 0
Labels: neweng, sharding-nyc-subteam2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-74568 SdamServerSelector sometimes doesn't ... Closed
Assigned Teams:
Sharding NYC
Operating System: ALL
Participants:
Story Points: 2

 Description   

If a minOpTime is specified on the read preference and no server fits that criteria then the tags will be removed from the targeting request: https://github.com/mongodb/mongo/blob/6f7dae919422dcd7f4892c10ff20cdc721ad00e6/src/mongo/client/sdam/server_selector.cpp#L76

minOpTime is optionally enforced, but the tags should be preserved to be possibly used in the switch statement that follows.



 Comments   
Comment by Kruti Shah [ 18/Jul/23 ]

Marking this ticket as a duplicate because it was handled in SERVER-74568.

The help ticket states that 'reads which fetch data from the config replica set fail if the client is set up with a corresponding readPreferenceTags option'. This revealed that tags are being deleted from the readPreference if minClusterTime needed to be ignored. There is already an unit test that checks that the tags aren't being deleted in this edge case. 

Comment by Kruti Shah [ 11/Jul/23 ]

There is another ticket to remove the const_cast: https://jira.mongodb.org/browse/SERVER-75907

Comment by Lamont Nelson [ 29/Jul/22 ]

We should also remove the const_cast of the read preference.

Generated at Thu Feb 08 06:10:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.