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

DBClientCursor not properly applying readConcern when passed in as an argument

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.9 Required
    • Component/s: None
    • None
    • Replication

      We use DBClientCursor to facilitate many of the calls supported by the DBClientBase interface (eg. DBClientBase::query). DBClientCursor accepts a readConcernObj as an optional argument. However, the readConcernObj passed in will always be overwritten to be empty due to the following:
      1. As part of initiating the DBClientCursor object, we use the legacy parsing code supplied by QueryRequest.
      2. This calls QueryRequest::init with fromQueryMessage always set to true.
      3. We will always initialize the query message with an empty readConcern.
      4. When trying to parse the QueryRequest as a findCommand, we will always have a readConcern field with an empty value.
      5. The parsed cmd will always have a readConcern field (but the value itself will always be empty) so we never actually enter this conditional to append the passed in readConcernObj.

      Since we use DBClientCursor for many of our DBClientConnection and DBDirectClient calls, having a readConcern field that doesn't actually append the readConcern is very misleading. Instead we should add an invariant to ensure that no readConcernObj is passed into DBClientCursor. We should also investigate whether the optional argument can be removed altogether.

      We already have a similar invariant for DBDirectClient::query but we should probably move it further down the chain to avoid confusion.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            jason.chan@mongodb.com Jason Chan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: