summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Fuschetto <antonio.fuschetto@mongodb.com>2021-07-02 15:04:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-02 15:46:08 +0000
commitc44149642e9d98624c8d705b97fe23ce20427953 (patch)
tree45b3515d5d9d76a2b8ad397ac4d94571f5471805
parente0987d2383a8146cb49ef9a01bbe9195a48af27b (diff)
downloadmongo-c44149642e9d98624c8d705b97fe23ce20427953.tar.gz
SERVER-57064 Log create index and dropIndex(es) on mongos
-rw-r--r--src/mongo/s/commands/cluster_create_indexes_cmd.cpp16
-rw-r--r--src/mongo/s/commands/cluster_drop_indexes_cmd.cpp17
2 files changed, 23 insertions, 10 deletions
diff --git a/src/mongo/s/commands/cluster_create_indexes_cmd.cpp b/src/mongo/s/commands/cluster_create_indexes_cmd.cpp
index b6d79c14943..4ece53ca87e 100644
--- a/src/mongo/s/commands/cluster_create_indexes_cmd.cpp
+++ b/src/mongo/s/commands/cluster_create_indexes_cmd.cpp
@@ -79,11 +79,17 @@ public:
CommandHelpers::filterCommandRequestForPassthrough(cmdObj),
ReadPreferenceSetting::get(opCtx),
Shard::RetryPolicy::kNoRetry);
- return appendRawResponses(opCtx,
- &errmsg,
- &output,
- std::move(shardResponses),
- {ErrorCodes::CannotImplicitlyCreateCollection});
+ const bool ok = appendRawResponses(opCtx,
+ &errmsg,
+ &output,
+ std::move(shardResponses),
+ {ErrorCodes::CannotImplicitlyCreateCollection});
+
+ if (ok) {
+ log() << "Indexes created on namespace " << nss;
+ }
+
+ return ok;
}
} createIndexesCmd;
diff --git a/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp b/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp
index c852b6f7064..5de8da89dde 100644
--- a/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp
+++ b/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp
@@ -84,11 +84,18 @@ public:
CommandHelpers::filterCommandRequestForPassthrough(cmdObj),
ReadPreferenceSetting::get(opCtx),
Shard::RetryPolicy::kNotIdempotent);
- return appendRawResponses(opCtx,
- &errmsg,
- &output,
- std::move(shardResponses),
- {ErrorCodes::NamespaceNotFound, ErrorCodes::IndexNotFound});
+ const bool ok =
+ appendRawResponses(opCtx,
+ &errmsg,
+ &output,
+ std::move(shardResponses),
+ {ErrorCodes::NamespaceNotFound, ErrorCodes::IndexNotFound});
+
+ if (ok) {
+ log() << "Indexes dropped on namespace " << nss;
+ }
+
+ return ok;
}
} dropIndexesCmd;