diff options
author | Antonio Fuschetto <antonio.fuschetto@mongodb.com> | 2021-07-02 15:04:59 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-07-02 15:46:08 +0000 |
commit | c44149642e9d98624c8d705b97fe23ce20427953 (patch) | |
tree | 45b3515d5d9d76a2b8ad397ac4d94571f5471805 | |
parent | e0987d2383a8146cb49ef9a01bbe9195a48af27b (diff) | |
download | mongo-c44149642e9d98624c8d705b97fe23ce20427953.tar.gz |
SERVER-57064 Log create index and dropIndex(es) on mongos
-rw-r--r-- | src/mongo/s/commands/cluster_create_indexes_cmd.cpp | 16 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_drop_indexes_cmd.cpp | 17 |
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; |