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

Improve selection criteria for srvMaxHosts

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • Cluster Management
    • None

    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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: