[SERVER-51196] Add "errorMessage" field to failCommand failpoint and ability to toggle error code Created: 28/Sep/20  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Kevin Albertson Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: sa-groomed
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-44466 Add "errorDocument" field to failComm... Closed
Assigned Teams:
Query Execution
Participants:

 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?


Generated at Thu Feb 08 05:24:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.