[JAVA-4400] Improve selection criteria for srvMaxHosts Created: 09/Nov/21  Updated: 23/Apr/23

Status: Backlog
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to JAVA-4252 Provide options to limit number of mo... Closed
is related to DRIVERS-1981 Reconsider interaction between srvMax... Backlog

 Description   

The logic should be

  1. Remove all nodes no longer present in the SRV response.
  2. Find all new nodes to add from the SRV response.
  3. Shuffle the new nodes (and only the new nodes).
  4. Select and add the first srvMaxHosts - numCurrentEndPoints + numRemovedEndPoints. Note that numCurrentEndPoints is the number prior to removing any. So it's not double-counting removed endpoints.

The net result is that it will keep existing nodes, discard deleted nodes, and fill up to srvMaxHosts from a random shuffle of newly discovered nodes from the SRV response.

The current behavior is:

  1. Find all nodes from the SRV response.
  2. Shuffle them
  3. Select and add the first srvMaxHosts nodes

Also implement the prose test:

Start with 27017, and 27018. Then replace the 27018 record with two additional records so you have: 27017, 27019, 27020. Assert that the topology has two hosts present and that one of the hosts is localhost.test.build.10gen.cc:27017. The second, new host will have been randomly selected


Generated at Thu Feb 08 09:01:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.