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

Selection of replicas in mongos not conforming to documentation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.5.2
    • Fix Version/s: None
    • Component/s: Internal Client, Sharding
    • Labels:
      None
    • Operating System:
      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

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: