Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-37250

Ban use of $out with read preferences other than "primary"

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Query 2018-10-22, Query 2018-11-05, Query 2018-11-19

      Aggregations with a $out stage fail when issued to a secondary on a replica set because we do not currently support reading from a primary and writing to a secondary. While this was always the case, with the new $out modes, we are now able to issue a $out to a secondary on a sharded cluster because we use the ClusterWriter. Though this is a nice feature, the behavior is not consistent between replica sets and sharded clusters. To provide consistency, we should ban reading from a secondary when the aggregation contains a $out stage. As connecting to a secondary is almost always achieved by setting readPreference to something other than "primary" (ie. "secondary", "secondaryPreferred", "primaryPreferred", or "nearest"), we should prohibit this combination. We should also clean up the error message issued to the user when they do connect directly with the secondary.

            Assignee:
            devin.hilly@mongodb.com Devin Hilly (Inactive)
            Reporter:
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: