diff options
author | Waley Chen <waleycz@gmail.com> | 2016-09-15 10:50:44 -0400 |
---|---|---|
committer | Waley Chen <waleycz@gmail.com> | 2016-09-15 10:51:14 -0400 |
commit | 2b0e9e69b7ae373bd11dff3c0814dec981806c4c (patch) | |
tree | 99a0be2ce6a13242909c8765a5e4c37c38ff9864 /src/mongo/shell/shell_options.cpp | |
parent | 6698877003e46995552dafacf2aaac86c351191c (diff) | |
download | mongo-2b0e9e69b7ae373bd11dff3c0814dec981806c4c.tar.gz |
SERVER-22688 Provide a setParameter and shell option to control the js heap limit
Diffstat (limited to 'src/mongo/shell/shell_options.cpp')
-rw-r--r-- | src/mongo/shell/shell_options.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/shell/shell_options.cpp b/src/mongo/shell/shell_options.cpp index 1b378836c35..3a2b55da126 100644 --- a/src/mongo/shell/shell_options.cpp +++ b/src/mongo/shell/shell_options.cpp @@ -200,6 +200,9 @@ Status addMongoShellOptions(moe::OptionSection* options) { if (!ret.isOK()) return ret; + options->addOptionChaining( + "jsHeapLimitMB", "jsHeapLimitMB", moe::Int, "set the js scope's heap size limit"); + return Status::OK(); } @@ -370,6 +373,16 @@ Status storeMongoShellOptions(const moe::Environment& params, } } + if (params.count("jsHeapLimitMB")) { + int jsHeapLimitMB = params["jsHeapLimitMB"].as<int>(); + if (jsHeapLimitMB <= 0) { + StringBuilder sb; + sb << "ERROR: \"jsHeapLimitMB\" needs to be greater than 0"; + return Status(ErrorCodes::BadValue, sb.str()); + } + shellGlobalParams.jsHeapLimitMB = jsHeapLimitMB; + } + if (shellGlobalParams.url == "*") { StringBuilder sb; sb << "ERROR: " |