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

:secondary_preferred read preference in 3.6+ sharded clusters performs primary read

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.14.1, 2.13.3
    • Affects Version/s: 2.14.0
    • Component/s: Query
    • None
    • Fully Compatible

      We tested an upgrade from mongo-ruby-driver 2.11.0 to 2.14.0 and had to roll it back because it caused queries with secondary preferred read preference to be routed to primaries by mongoses and overloaded our primary mongoD servers. We have a sharded mongoS environment running MongoDB 4.0.12 with WiredTiger.

      We make heavy use of read(:mode => {:secondary_preferred}) in our code. It seems that with https://github.com/mongodb/mongo-ruby-driver/pull/1932 to fit the spec $readPreference is only sent when a non-mode field is present. This had a result of no longer sending "$readPreference"=>{"mode"=>"secondaryPreferred"}" down with our queries. We set verbose logging to true on our secondaries and found that all secondary queries stopped.

      I can update our code to put maxStalenessSeconds everywhere but this seems like it is a change that should have had a major version bump? What do you recommend for how to fix this?

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            jon@braze.com Jon Hyman
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: