summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaddie Zechar <mez2113@columbia.edu>2021-05-24 16:37:46 +0000
committerMaddie Zechar <mez2113@columbia.edu>2021-06-24 22:29:28 +0000
commit7145bb5e73547c2ddc17012b5b6ebaaab8952546 (patch)
tree8032390096e3025656c29acef56758b32e662fa8 /src
parent70397073ac3fb14afc19f69bebf0f67cab041a16 (diff)
downloadmongo-7145bb5e73547c2ddc17012b5b6ebaaab8952546.tar.gz
SERVER-57258: Add deprecation msg for mapReduce()
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/map_reduce_agg.cpp11
-rw-r--r--src/mongo/s/commands/cluster_map_reduce_agg.cpp11
2 files changed, 19 insertions, 3 deletions
diff --git a/src/mongo/db/commands/map_reduce_agg.cpp b/src/mongo/db/commands/map_reduce_agg.cpp
index 43a66fb2314..b75a18a4a77 100644
--- a/src/mongo/db/commands/map_reduce_agg.cpp
+++ b/src/mongo/db/commands/map_reduce_agg.cpp
@@ -26,7 +26,7 @@
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
-
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
#include "mongo/platform/basic.h"
#include <boost/intrusive_ptr.hpp>
@@ -53,10 +53,12 @@
#include "mongo/db/query/explain_common.h"
#include "mongo/db/query/map_reduce_output_format.h"
#include "mongo/db/query/plan_executor_factory.h"
+#include "mongo/logv2/log.h"
namespace mongo::map_reduce_agg {
namespace {
+Rarely _sampler;
auto makeExpressionContext(OperationContext* opCtx,
const MapReduceCommandRequest& parsedMr,
@@ -112,6 +114,13 @@ bool runAggregationMapReduce(OperationContext* opCtx,
const BSONObj& cmd,
BSONObjBuilder& result,
boost::optional<ExplainOptions::Verbosity> verbosity) {
+
+ if (_sampler.tick()) {
+ LOGV2_WARNING(5725801,
+ "The map reduce command is deprecated. For more information, see "
+ "https://docs.mongodb.com/manual/core/map-reduce/");
+ }
+
auto exhaustPipelineIntoBSONArray = [](auto&& exec) {
BSONArrayBuilder bab;
BSONObj obj;
diff --git a/src/mongo/s/commands/cluster_map_reduce_agg.cpp b/src/mongo/s/commands/cluster_map_reduce_agg.cpp
index 9d16d22513f..7cba5b51bd5 100644
--- a/src/mongo/s/commands/cluster_map_reduce_agg.cpp
+++ b/src/mongo/s/commands/cluster_map_reduce_agg.cpp
@@ -26,7 +26,7 @@
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
-
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
#include "mongo/platform/basic.h"
#include "mongo/bson/bsonobj.h"
@@ -47,6 +47,7 @@
#include "mongo/db/query/explain_common.h"
#include "mongo/db/query/getmore_request.h"
#include "mongo/db/query/map_reduce_output_format.h"
+#include "mongo/logv2/log.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/cluster_commands_helpers.h"
#include "mongo/s/commands/cluster_map_reduce_agg.h"
@@ -55,7 +56,7 @@
namespace mongo {
namespace {
-
+Rarely _sampler;
auto makeExpressionContext(OperationContext* opCtx,
const MapReduceCommandRequest& parsedMr,
const ChunkManager& cm,
@@ -152,6 +153,12 @@ bool runAggregationMapReduce(OperationContext* opCtx,
auto resolvedOutNss = NamespaceString{hasOutDB ? *hasOutDB : parsedMr.getNamespace().db(),
parsedMr.getOutOptions().getCollectionName()};
+ if (_sampler.tick()) {
+ LOGV2_WARNING(5725800,
+ "The map reduce command is deprecated. For more information, see "
+ "https://docs.mongodb.com/manual/core/map-reduce/");
+ }
+
if (parsedMr.getOutOptions().getOutputType() != OutputType::InMemory) {
involvedNamespaces.insert(resolvedOutNss);
}