summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2019-09-09 21:21:47 +0000
committerevergreen <evergreen@mongodb.com>2019-09-09 21:21:47 +0000
commit76d7ffa54c8214f4139dd336a036d759ed86dad3 (patch)
tree7e08ca628a3900792c2484b155728ea83fb42d14 /src
parent042654e90bfb336c647e2b693962a3ceace8cde4 (diff)
downloadmongo-76d7ffa54c8214f4139dd336a036d759ed86dad3.tar.gz
SERVER-42888 Fix deprecate CodeWScope log message frequency
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/mr.cpp7
-rw-r--r--src/mongo/db/commands/mr.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 75dde5374ad..1d7400a634b 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -96,6 +96,9 @@ namespace mr {
namespace {
Rarely mapParamsDeprecationSampler; // Used to occasionally log deprecation messages.
+// Used to log occassional deprecation warnings when CodeWScope is used in MapReduce.
+Rarely mapReduceCodeWScopeSampler;
+
/**
* Runs a count against the namespace specified by 'ns'. If the caller holds the global write lock,
@@ -232,8 +235,8 @@ JSFunction::JSFunction(const std::string& type, const BSONElement& e) {
_code = e._asCode();
if (e.type() == CodeWScope) {
- if (_sampler.tick())
- warning() << "Use of CodeWScope with MapReduce is deprecated. Prefer putting all scope "
+ if (mapReduceCodeWScopeSampler.tick())
+ warning() << "Use of CodeWScope with MapReduce is deprecated. Put all scope "
"variables in the scope parameter of the MapReduce command";
_wantedScope = e.codeWScopeObject();
}
diff --git a/src/mongo/db/commands/mr.h b/src/mongo/db/commands/mr.h
index 70cdaebcbd5..03ceeab900e 100644
--- a/src/mongo/db/commands/mr.h
+++ b/src/mongo/db/commands/mr.h
@@ -130,8 +130,6 @@ private:
std::string _type;
std::string _code; // actual javascript code
BSONObj _wantedScope; // this is for CodeWScope
- // Used to log occassional deprecation warnings when CodeWScope is used in MapReduce.
- Rarely _sampler;
Scope* _scope; // this is not owned by us, and might be shared
ScriptingFunction _func;