diff options
author | natalie.tsvetkova <natalie.tsvetkova@mongodb.com> | 2018-10-24 15:01:35 -0400 |
---|---|---|
committer | Natalie Tsvetkova <natalie.tsvetkova@mongodb.com> | 2018-11-02 16:02:05 -0400 |
commit | b2f8859fbb0fd0aaaf96dcd1451df3b9844c2eb1 (patch) | |
tree | 4c403bc2a9169e14e0996d7595923c24cbfa10ce /src/mongo/db/commands.h | |
parent | bdfe090c66532ea921b4968a32632331c0c44310 (diff) | |
download | mongo-b2f8859fbb0fd0aaaf96dcd1451df3b9844c2eb1.tar.gz |
SERVER-35518: Support the failCommand fail point in mongoS
Diffstat (limited to 'src/mongo/db/commands.h')
-rw-r--r-- | src/mongo/db/commands.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index 5b47d9db106..d2445729ee8 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -50,10 +50,13 @@ #include "mongo/rpc/op_msg.h" #include "mongo/rpc/reply_builder_interface.h" #include "mongo/stdx/functional.h" +#include "mongo/util/fail_point_service.h" #include "mongo/util/string_map.h" namespace mongo { +MONGO_FAIL_POINT_DECLARE(failCommand); + class Command; class CommandInvocation; class OperationContext; @@ -245,6 +248,16 @@ struct CommandHelpers { static Status canUseTransactions(StringData dbName, StringData cmdName); static constexpr StringData kHelpFieldName = "help"_sd; + + /** + * Checks if the command passed in is in the list of failCommands defined in the fail point. + */ + static bool shouldActivateFailCommandFailPoint(const BSONObj& data, StringData cmdName); + + /** + * Possibly uasserts according to the "failCommand" fail point. + */ + static void evaluateFailCommandFailPoint(OperationContext* opCtx, StringData commandName); }; /** @@ -333,7 +346,7 @@ public: /** * Return true if the command requires auth. - */ + */ virtual bool requiresAuth() const { return true; } |