summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2020-04-06 14:23:33 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-07 21:00:58 +0000
commit021db11a119f431d25afef650735cbf61a823a40 (patch)
tree5fa24c28cf25e0f49dde4f883c4c66437de1e51f /src
parente03fe6ff798f50382122edd469743677d401e001 (diff)
downloadmongo-021db11a119f431d25afef650735cbf61a823a40.tar.gz
SERVER-47195 Allow configuring failCommand failpoint to activate only for a given appName
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index f9158eb2a62..52363e5f2be 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -543,6 +543,14 @@ bool CommandHelpers::shouldActivateFailCommandFailPoint(const BSONObj& data,
return false;
}
+ if (data.hasField("appName")) {
+ const auto& clientMetadata = ClientMetadataIsMasterState::get(client).getClientMetadata();
+ if (clientMetadata &&
+ clientMetadata.get().getApplicationName() != data.getStringField("appName")) {
+ return false; // only activate failpoint on connection with a certain appName
+ }
+ }
+
if (client->session() && (client->session()->getTags() & transport::Session::kInternalClient)) {
if (!data.hasField("failInternalCommands") || !data.getBoolField("failInternalCommands")) {
return false;