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

ReadPreference.nearest() does not count primary in expected way

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.11.0
    • Affects Version/s: 2.10.0
    • Component/s: Cluster Management
    • Labels:
      None
    • Environment:
      Java 1.7, Mongodb 2.2

      My configuration is very simple, I've two servers A[primary] and B[secondary] geographically distributed with ~120 ms ping distance. Both A and B runs application with ReadPreference.nearest().
      I would expect, that reads from A server hits only A mongodb and reads from B hits only B. However it is not working this way. What I observe is that reads from application on B hits B[secondary] only. But reads from application on A hits both A[primary] and B[secondary].
      It looks like nearest() does not mean: "read from nearest node, where nearest is where ping time < 15ms" but: "read from nearest SECONDARY node where ping time < 15 ms OR any if no such secondary node".

      Is it expected behaviour?

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

              Created:
              Updated:
              Resolved: