-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
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?
- is related to
-
SERVER-44466 Add "errorDocument" field to failCommand fail point
- Closed