[GODRIVER-2222] Fix srvMaxHosts SRV polling shuffling logic Created: 09/Nov/21  Updated: 28/Oct/23  Resolved: 23/Nov/21

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.8.0

Type: Bug Priority: Minor - P4
Reporter: Benji Rewis (Inactive) Assignee: Matt Dale
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to DRIVERS-1981 Reconsider interaction between srvMax... Backlog

 Description   

In SRV polling, if srvMaxHosts is declared, we currently shuffle the list of parsed hosts returned from t.dnsResolver.ParseHosts and then call processSRVResults on those parsed hosts. Depending on the outcome of the shuffle, that logic can result in accidentally losing an existing SRV record. We should move the shuffling logic for SRV polling into processSRVResults to account for this.

Also, now that we've dropped support for Golang 1.9, we can just use rand.Shuffle here and here as stated in the TODO (I missed this in GODRIVER-1876).



 Comments   
Comment by Githook User [ 23/Nov/21 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2222 Prevent removing valid servers when updating SRV hosts. (#805)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/a452f5120afd0bc3bb7c3086f39f2895d3c581f8

Comment by Matt Dale [ 13/Nov/21 ]

PR: https://github.com/mongodb/mongo-go-driver/pull/805

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