[SERVER-49696] ReplicaSetMonitor does not randomize host order for getHosts Created: 17/Jul/20  Updated: 29/Oct/23  Resolved: 22/Jul/20

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

Type: Bug Priority: Major - P3
Reporter: Benjamin Caimano (Inactive) Assignee: Lamont Nelson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File rsm_host_order.js    
Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Steps To Reproduce:

I've attached a javascript test that sends reads in sequence to a 3 node shard and confirms that the third node is not used.

Sprint: Sharding 2020-07-27
Participants:

 Description   

Original description: While there is a function to randomly select, it is only used for single host selection here. This has implications for both connection reuse and read hedging. It means that if we have available connections to all hosts, we will always choose the first one in order if there is an available connection, essentially prioritizing that host. If we are hedging reads, we will also chose the second one in order for our hedge, which prioritizes yet another host and makes that host the one considered the "hedge" for our statistics. We should randomize the multiple host selection here as well.



 Comments   
Comment by Githook User [ 22/Jul/20 ]

Author:

{'name': 'LaMont Nelson', 'email': 'lamont.nelson@mongodb.com', 'username': 'lamontnelson'}

Message: SERVER-49696 randomize host order for getHosts

(cherry picked from commit 6fc13dc855f3ead1678072e4b9bf9ab645e5fd49)
Branch: v4.4
https://github.com/mongodb/mongo/commit/9ec0c9163ada14852b7b7814dfc829b92e4933cf

Comment by Githook User [ 22/Jul/20 ]

Author:

{'name': 'LaMont Nelson', 'email': 'lamont.nelson@mongodb.com', 'username': 'lamontnelson'}

Message: SERVER-49696 randomize host order for getHosts
Branch: master
https://github.com/mongodb/mongo/commit/6fc13dc855f3ead1678072e4b9bf9ab645e5fd49

Comment by Lamont Nelson [ 21/Jul/20 ]

https://evergreen.mongodb.com/version/5f172cc39ccd4e7feacd1092

Generated at Thu Feb 08 05:20:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.