Aggregation with write stage not using provided read preference

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Aggregation
    • 2
    • None
    • Not Needed
    • 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. secondary-test.ts
          2 kB
        2. ruby.rb
          0.8 kB
        3. nodejs.ts
          1 kB
        4. monitoring.rb
          1 kB

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

              Created:
              Updated: