diff options
author | Jacob Evans <jacob.evans@10gen.com> | 2022-10-24 16:46:18 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-24 17:30:22 +0000 |
commit | 6021eb2e075d3e974b2cc6086ca655d86af0dd63 (patch) | |
tree | 7813fb3707a8324e4ffa5c9d7db4ba23fbca96d9 | |
parent | f689de6408ddafc503c9f223c3543be96f485f06 (diff) | |
download | mongo-6021eb2e075d3e974b2cc6086ca655d86af0dd63.tar.gz |
SERVER-70246 Deprecate collStats
-rw-r--r-- | src/mongo/db/commands/dbcommands.cpp | 7 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_coll_stats_cmd.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index b985611d842..ae8172b1494 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -427,6 +427,8 @@ public: } cmdDatasize; +Rarely _collStatsSampler; + class CmdCollStats final : public BasicCommandWithRequestParser<CmdCollStats> { public: using Request = CollStatsCommand; @@ -452,6 +454,11 @@ public: const BSONObj& cmdObj, const RequestParser& requestParser, BSONObjBuilder& result) final { + if (_collStatsSampler.tick()) + LOGV2_WARNING(7024600, + "The collStats command is deprecated. For more information, see " + "https://dochub.mongodb.org/core/collStats-deprecated"); + const auto& cmd = requestParser.request(); const auto& nss = cmd.getNamespace(); diff --git a/src/mongo/s/commands/cluster_coll_stats_cmd.cpp b/src/mongo/s/commands/cluster_coll_stats_cmd.cpp index b33da24608f..416ae71d287 100644 --- a/src/mongo/s/commands/cluster_coll_stats_cmd.cpp +++ b/src/mongo/s/commands/cluster_coll_stats_cmd.cpp @@ -45,6 +45,8 @@ namespace mongo { namespace { +Rarely _sampler; + auto fieldIsAnyOf = [](StringData v, std::initializer_list<StringData> il) { auto ei = il.end(); return std::find(il.begin(), ei, v) != ei; @@ -199,6 +201,11 @@ public: const DatabaseName& dbName, const BSONObj& cmdObj, BSONObjBuilder& result) override { + if (_sampler.tick()) + LOGV2_WARNING(7024601, + "The collStats command is deprecated. For more information, see " + "https://dochub.mongodb.org/core/collStats-deprecated"); + const NamespaceString nss(parseNs(dbName, cmdObj)); const auto targeter = ChunkManagerTargeter(opCtx, nss); |