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

Add "errorMessage" field to failCommand failpoint and ability to toggle error code

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • None
    • Query Execution

    Description

      Error handling in drivers currently relies on message substring checks for "not master" and "node is recovering". It is used to help determine whether an error is a server state change error per SDAM, or if it is a retryable read / write error. We intend to remove those checks in DRIVERS-1152, but we are unable to test it with our existing SDAM integration test runner. The test runner uses the failCommand failpoint to simulate errors. But failCommand responses have a fixed errmsg: "Failing command due to 'failCommand' failpoint", so we cannot check the substring matching behavior.

      If possible, could the failCommand arguments have an additional errorMessage field to overwrite or append to the returned errmsg? Here is an example API proposal:

      db.adminCommand({
          configureFailPoint: "failCommand",
          mode: "alwaysOn",
          data: {failCommands: ["find"], errorMessage: "node is recovering", errorCode: 123}
      });
      // Returns {ok: 0, code: 123, errmsg: "node is recovering" }
      db.runCommand({find: "collection"});
      db.adminCommand({configureFailPoint: "failCommand", mode: "off"}); 
      

      Secondly, drivers error handling checks for the presence of an error code. Older MongoDB servers may not return an error code in all cases. Would it be possible to make errorCode optional so we can test the omission of an error code?

      Attachments

        Issue Links

          Activity

            People

              backlog-query-execution Backlog - Query Execution
              kevin.albertson@mongodb.com Kevin Albertson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: