DBDirectClient does not restore the readPreference when leaving its scope

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      As part of SERVER-131669 we added an aggregation that could run on secondary nodes as part of DBDirectClient.

      This however, resulted in seeing inconsistencies for subsequent aggregations being sent to other remote shards as they were being sent to potentially lagged secondary nodes while it originally would only go to primary nodes.

      After a short investigation we discovered that this DBDirectClient call setting secondaryOk will make the change to the readPreference sticky on the opCtx since it fails to restore the original readPreference once that aggregation is finished.

            Assignee:
            Gabriel Spil
            Reporter:
            Jordi Olivares Provencio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: