Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-926

ReadPreference.NEAREST can route operations to arbiters in PyMongo 3.0

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.2
    • Affects Version/s: 3.0, 3.0.1
    • Component/s: None
    • Environment:
      ubuntu 14.04, mongodb=3.0.2, pymongo=3.0.1

      Setup is 3 node replica-set consisting of
      1 Primary, 1 Secondary, 1 Arbiter.

      Setting `w=2` and `read_preference=pymongo.ReadPreference.NEAREST` results in getting wrong results to queries occasionally.

      See attached example program. Output from the program on my system is:

      python pymongo_bug.py
      found 1 docs
      found 0 docs WHICH IS WRONG
      found 0 docs WHICH IS WRONG
      found 4 docs
      found 0 docs WHICH IS WRONG
      found 6 docs
      found 7 docs
      ...

      Setting read_preference to Primary or Secondary solves the problem.

        1. pymongo_bug.py
          0.6 kB
          Anders Bennehag

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            andersbennehag Anders Bennehag
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: