summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-10-21 17:24:14 -0400
committerSpencer T Brody <spencer@mongodb.com>2015-10-22 13:08:16 -0400
commit14172523b2afcb4b1c3837cd777a5373a3be1441 (patch)
treea8089c5a81c4fb5fcd015b2990b96d35ae7c6f7a /src/mongo/db
parent33ee46d9afb324e31433d6389ca6bbaa2257deca (diff)
downloadmongo-14172523b2afcb4b1c3837cd777a5373a3be1441.tar.gz
SERVER-20889 Add server parameter for disabling sharding state recovery
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/s/sharding_state_recovery.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/s/sharding_state_recovery.cpp b/src/mongo/db/s/sharding_state_recovery.cpp
index 0f30b4d9d27..de59a1310fc 100644
--- a/src/mongo/db/s/sharding_state_recovery.cpp
+++ b/src/mongo/db/s/sharding_state_recovery.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/s/sharding_state.h"
+#include "mongo/db/server_parameters.h"
#include "mongo/db/write_concern.h"
#include "mongo/db/write_concern_options.h"
#include "mongo/s/client/shard_registry.h"
@@ -66,6 +67,8 @@ const WriteConcernOptions kMajorityWriteConcern(WriteConcernOptions::kMajority,
WriteConcernOptions::NONE,
kWriteTimeout);
+MONGO_EXPORT_STARTUP_SERVER_PARAMETER(recoverShardingState, bool, true);
+
/**
* Encapsulates the parsing and construction of the config server min opTime recovery document.
*/
@@ -237,6 +240,13 @@ void ShardingStateRecovery::endMetadataOp(OperationContext* txn) {
}
Status ShardingStateRecovery::recover(OperationContext* txn) {
+ if (!recoverShardingState) {
+ warning()
+ << "Not checking for ShardingState recovery document because the recoverShardingState "
+ "server parameter is set to false";
+ return Status::OK();
+ }
+
BSONObj recoveryDocBSON;
try {