findAndModify rawData argument: routing and authorization paths disagree on whether `false` means raw-data mode

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • Fully Compatible
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The rawData argument on findAndModify (an OptionalBool, three states: unset / false / true) is interpreted inconsistently across two code paths:

      • The cluster-side routing logic in src/mongo/s/commands/query_cmd/cluster_find_and_modify_cmd.cpp enters raw-data execution mode when getRawData().has_value() is true. This is true for both rawData: false and rawData: true.
      • The generic argument handling in src/mongo/db/commands.cpp only treats the operation as raw-data when getRawData() is truthy — i.e. only rawData: true.

      The two sites should agree. The simpler alignment is for the routing logic to use the truthy value rather than has_value(), matching commands.cpp and the pre-TypedCommand behavior. The regression was introduced as part of SERVER-119290 (commit dab99de2) when cluster findAndModify was converted to TypedCommand; the prior implementation used a truthy check.

      Two call sites in cluster_find_and_modify_cmd.cpp need to change (run() and explain() paths):

      -    if (originalRequest.getRawData().has_value() || originalNss.isTimeseriesBucketsCollection()) {
      +    if (originalRequest.getRawData() || originalNss.isTimeseriesBucketsCollection()) {
               isRawDataOperation(opCtx) = true;
           }
      

      Lines cluster_find_and_modify_cmd.cpp:640 and :761 on master.

            Assignee:
            Natalie Hill
            Reporter:
            Valentin Leon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: