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

QueryRequest::_readConcern might be better as a ReadConcernArgs

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
    • Query Optimization
    • Fully Compatible

      Recently on SERVER-43712 there was a need to update QueryRequest to distinguish between absent (unspecified) readConcern, and readConcern which is an empty sub-object.

      This was done by changing _readConcern from BSONObj to boost::optional<BSONObj>, but this results in some awkwardness when preserving the getReadConcern() return value of const BSONObj& (because return _readConcern.value_or(BSONObj()); would return a reference to a temporary), and other awkwardness when interacting with the readConcern on the opCtx.

      An alternative would be to keep _readConcern as BSONObj and have a bool _readConcernHasBeenSet = false; alongside it. But this would be ugly and clunky in other ways, by having to maintain and coordinate these tandem variables.

      It might be better if _readConcern was updated to be of type ReadConcernArgs instead, since this is the more natural representation of read concern (eg. it can easily and correctly distinguish between unspecified and empty readConcerns).

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: