Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2219

Force read preference primaryPreferred in Single topology

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.12.0
    • Affects Version/s: None
    • Component/s: Query
    • None
    • Minor Change

      It appears that the driver currently has the following behavior when in a direct connection (Single topology) to a secondary RS member:

      • Server 2.6: slaveok=true is always added to the queries, even if user explicitly specified read preference: primary. These servers don't support $readPreference specification that OP_MSG supports hence the driver effectively changes the user's explicitly provided read preference, silently.
      • Server 4.4: equivalent of slaveok=true is not added unless the user explicitly requested read preference: secondary or secondary preferred. Read queries fail unless read preference is explicitly given.

      Per https://jira.mongodb.org/browse/DRIVERS-1191, the behavior for 2.6 servers is correct - read preference must be overwritten with primaryPreferred when in Single topology regardless of user input. This ticket covers changing 3.6+ servers to have this behavior.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: