Aggregation with write stage not using provided read preference

XMLWordPrintableJSON

    • 0
    • 2
    • Not Needed
    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      I have several aggregations using $out or $merge ("write stages") where I want to read from a secondary using readPreference: 'secondary'.

      The provided readPreference is not used if the operation has a write stage in execeute_operation because topology.commonWireVersion is 0, resulting in the wrong custom server selector being returned in server_selection where it falls back to using ReadPreference.primary.

       

      Root cause is probably commonWireVersion being initialised with 0 instead of null in topology_description_ctor and then not being updated in topology_description_update

       

      User Experience

      • Desired outcome: The provided read preference is used when operation has write stage.
      • Impact: All customers using aggregations with write stages and read preference 'secondary'. Falls back to primary read preference.

      Dependencies

      • n/a

      Risks/Unknowns

      • n/a

      Acceptance Criteria

      Implementation Requirements

      • functional reqs, potential snafus to avoid, performance targets, etc

      Testing Requirements

      • unit test, spec test sync, etc

      Documentation Requirements

      • DOCSP ticket, API docs, etc

      Follow Up Requirements

      • additional tickets to file, required releases, etc
      • if node behavior differs/will differ from other drivers, confirm with dbx devs what standard to aim for and what plan, if any, exists to reconcile the diverging behavior moving forward

        1. monitoring.rb
          1 kB
        2. nodejs.ts
          1 kB
        3. ruby.rb
          0.8 kB
        4. secondary-test.ts
          2 kB

            Assignee:
            Sergey Zelenov
            Reporter:
            Christoph Rehbichler
            Sergey Zelenov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: