diff options
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/commands/getmore_cmd.cpp | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript index 0b2f570ac1d..39a49adaab8 100644 --- a/src/mongo/db/commands/SConscript +++ b/src/mongo/db/commands/SConscript @@ -359,6 +359,7 @@ env.Library( '$BUILD_DIR/mongo/db/views/views_mongod', '$BUILD_DIR/mongo/executor/async_request_executor', '$BUILD_DIR/mongo/idl/feature_flag', + '$BUILD_DIR/mongo/rpc/rewrite_state_change_errors', '$BUILD_DIR/mongo/util/log_and_backoff', '$BUILD_DIR/mongo/util/net/http_client', 'core', diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index 88eb60eb201..662038b4993 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -36,6 +36,7 @@ #include <memory> #include <string> +#include "mongo/bson/util/bson_extract.h" #include "mongo/db/api_parameters.h" #include "mongo/db/auth/authorization_checks.h" #include "mongo/db/auth/authorization_session.h" @@ -64,6 +65,7 @@ #include "mongo/db/stats/resource_consumption_metrics.h" #include "mongo/db/stats/top.h" #include "mongo/logv2/log.h" +#include "mongo/rpc/rewrite_state_change_errors.h" #include "mongo/s/chunk_version.h" #include "mongo/util/fail_point.h" #include "mongo/util/scopeguard.h" @@ -567,7 +569,11 @@ public: // If the 'failGetMoreAfterCursorCheckout' failpoint is enabled, throw an exception with // the given 'errorCode' value, or ErrorCodes::InternalError if 'errorCode' is omitted. failGetMoreAfterCursorCheckout.executeIf( - [](const BSONObj& data) { + [&](const BSONObj& data) { + if (bool b; + !bsonExtractBooleanField(data, "allowRewriteStateChange", &b).isOK() || !b) + rpc::RewriteStateChangeErrors::setEnabled(opCtx, false); + auto errorCode = (data["errorCode"] ? data["errorCode"].safeNumberLong() : ErrorCodes::InternalError); uasserted(errorCode, "Hit the 'failGetMoreAfterCursorCheckout' failpoint"); |