summaryrefslogtreecommitdiff
path: root/src/mongo/shell/shell_options.cpp
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2017-11-08 19:29:28 -0500
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2017-11-08 19:29:28 -0500
commit6d8e6b9cce052cdd442e207a27df10e698b2bb00 (patch)
tree5a7bb7b5cf93902bf00a681dccb0f54adb2f1ab0 /src/mongo/shell/shell_options.cpp
parentf7756c41c5ed54e8e546461395bc8898d885af0c (diff)
downloadmongo-6d8e6b9cce052cdd442e207a27df10e698b2bb00.tar.gz
SERVER-31296 Update sessions, causal, and retryable in the mongo shell.
* Removes the initialClusterTime and initialOperationTime session options. * Enables causal consistency by default when using an explicit session. * Adds a --retryWrites command line option to the mongo shell for enabling retryable writes in the mongo shell. The retryWrites options to SessionOptions is left for convenience with testing. * Renames setClusterTime() to advanceClusterTime(), and adds a corresponding advanceOperationTime() method to DriverSession. * Enables assigning transaction numbers for write commands where ordered=false. * Prevents the mongo shell from sending afterClusterTime or assigning transaction numbers when talking to a stand-alone mongod. * Prevents the mongo shell from assigning transaction numbers when using an unacknowledged (w=0) writeConcern. * Changes DBClientRS to re-discover the current primary of the replica set when it receives an error code representing "not master" in addition to an error message representing "not master". * Adds a shellPrint() pretty-printer for SessionOptions and DriverSession instances so they no longer print out their entire object definition.
Diffstat (limited to 'src/mongo/shell/shell_options.cpp')
-rw-r--r--src/mongo/shell/shell_options.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/shell/shell_options.cpp b/src/mongo/shell/shell_options.cpp
index 7898fc6fa1b..f14798a2273 100644
--- a/src/mongo/shell/shell_options.cpp
+++ b/src/mongo/shell/shell_options.cpp
@@ -208,6 +208,12 @@ Status addMongoShellOptions(moe::OptionSection* options) {
" commands, compatibility, legacy")
.hidden();
+ options->addOptionChaining(
+ "retryWrites",
+ "retryWrites",
+ moe::Switch,
+ "automatically retry write operations upon transient network errors");
+
options
->addOptionChaining(
"rpcProtocols", "rpcProtocols", moe::String, " none, opQueryOnly, opCommandOnly, all")
@@ -363,6 +369,9 @@ Status storeMongoShellOptions(const moe::Environment& params,
}
shellGlobalParams.readMode = mode;
}
+ if (params.count("retryWrites")) {
+ shellGlobalParams.shouldRetryWrites = true;
+ }
if (params.count("rpcProtocols")) {
std::string protos = params["rpcProtocols"].as<string>();
auto parsedRPCProtos = rpc::parseProtocolSet(protos);