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

Remove RemoteCommandResponse::status

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Networking & Observability
    • N&O Prioritized List

      A RemoteCommandResponse either contains a BSONObj (.data) or a Status (.status), depending on whether a response was received from the remote or if a local error occurred that prevented it. This status field makes working with RemoteCommandResponse in future-returning code very awkward and error prone, since it isn't clear when the local error will be reported via the future itself or in the status field. It also prevents one from using error-handling Future continuation chaining (e.g. onError), as errors contained with the status may be missed. There are several places in the codebase where we have to remember to check both, and other cases where we standardize on the .status field. It would be much simpler if the .status field didn't exist altogether, and if "local" errors were reported via the future or a wrapping StatusWith.

      This field was originally introduced in SERVER-24067 to allow reporting of elapsed time even for failures. We should reevaluate whether this is valuable enough now that we use RemoteCommandResponse with futures frequently. If not, we should remove the status field altogether.

      example wrapping: https://github.com/10gen/mongo/blob/c54222193d2e87aaf3b1dfde4a37161bbaa09db5/src/mongo/executor/network_interface_tl.cpp#L948-L951

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: