Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10686

Selection of replicas in mongos not conforming to documentation

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.5.2
    • Internal Client, Sharding
    • None
    • ALL

    Description

      The mechanism in mongos to select a replica with secondary read preference does not do what the documentation says it does.

      At http://docs.mongodb.org/manual/core/read-preference-mechanics/#member-selection it says that the algorithm takes the nearest replica (lowest ping time), and then computes a set of other replicas that are no further than the lowest ping time plus the value of --localThreshold. It then chooses one of these replicas at random.

      Looking at the code in dbclient_rs.cpp, it takes --localThreshold as an absolute value and returns the first node that has a ping time less than that. If there is no such node, it returns a random node that matches the tags.

      For comparison, I checked the Java driver and found that it implements what the documentation says.

      Attachments

        Activity

          People

            randolph@mongodb.com Randolph Tan
            andre.spiegel@mongodb.com Andre Spiegel
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: