Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2357

"not master" error directly querying secondary with OP_MSG

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.9.0
    • Component/s: libmongoc
    • Labels:
      None

      In the OP_QUERY wire protocol we can directly connect to a secondary by setting the slaveOkay bit for all messages when TopologyType is Single. With OP_MSG there's no such bit, so reads are rejected with "not master and slaveOk=false".

      Solution: include {$readPreference: "primaryPreferred"} with all messages if there's no read preference, the wire protocol is OP_MSG, and TopologyType is Single.

      Refactor the existing code in mongoc-cursor.c and mongoc_collection_aggregate that does this especially for cursors with a serverId set.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: