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

Add "errorDocument" field to failCommand fail point

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Backport Requested:
      v4.4, v4.2
    • Sprint:
      Service Arch 2020-04-06

      Description

      Drivers use the failCommand fail point extensively in spec tests. It seems that with each server release we need to add a new knob to this fail point in order to test new features. In 4.0 we added the "writeConcernError" field (SERVER-35083). In 4.4 we're adding the "errorLabels" field (SERVER-43941).

      It might be useful to add a way for the command to specify the entire error document to return instead of just the error code or the errorLabels. For example:

      db.adminCommand({
          configureFailPoint: "failCommand",
          mode: "alwaysOn",
          data: {failCommands: ["find"], errorDoc: {ok: 0, code: 2, errmsg: "my error message", errorLabels: ["Label"]}}
      });
      // Returns {ok: 0, code: 2, errmsg: "my error message", errorLabels: ["Label"]}
      db.runCommand({find: "collection"});
      db.adminCommand({configureFailPoint: "failCommand", mode: "off"});
      

      This would also satisfy SERVER-42239 since the user could add "extraInfo" to the errorDoc.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              spencer Spencer Brody (Inactive)
              Reporter:
              shane.harvey Shane Harvey
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: