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

QueryRequest::_readConcern might be better as a ReadConcernArgs



    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Querying
    • Labels:
    • Backwards Compatibility:
      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).


          Issue Links



              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: