diff options
author | Antonio Fuschetto <antonio.fuschetto@mongodb.com> | 2021-07-02 15:04:56 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-07-02 15:48:21 +0000 |
commit | e449bf28ca66cc5754aa59df56e60a71d6811340 (patch) | |
tree | c7437b5da2c98a066ae67a71018c4e1db2176574 /src | |
parent | d7fd78dead621a539c20791a93abec34bb1be385 (diff) | |
download | mongo-e449bf28ca66cc5754aa59df56e60a71d6811340.tar.gz |
SERVER-57064 Log create index and dropIndex(es) on mongos
Diffstat (limited to 'src')
-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 89173b4f555..c0d5d1d1b7a 100644 --- a/src/mongo/s/commands/cluster_create_indexes_cmd.cpp +++ b/src/mongo/s/commands/cluster_create_indexes_cmd.cpp @@ -76,11 +76,17 @@ public: auto shardResponses = dispatchCommandAssertCollectionExistsOnAtLeastOneShard( opCtx, nss, ReadPreference::PrimaryOnly, cmdObj); - 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 9dca911b224..691026712cb 100644 --- a/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp @@ -83,11 +83,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; |