Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4400

Improve selection criteria for srvMaxHosts

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Cluster Management
    • None

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: