summaryrefslogtreecommitdiff
path: root/src/mongo/db/s
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2016-04-26 17:57:24 -0400
committerJudah Schvimer <judah@mongodb.com>2016-04-26 17:57:24 -0400
commit1ed034b959e15d5882a0dda072eef3435678248b (patch)
tree1c9c4a3f725e3399d6257af58ee4802a8bb7eb7e /src/mongo/db/s
parentd6a77a0135db56972b2626a08e20a240a770f66f (diff)
downloadmongo-1ed034b959e15d5882a0dda072eef3435678248b.tar.gz
SERVER-23340 Turn off secondaryThrottle by default
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r--src/mongo/db/s/chunk_move_write_concern_options.cpp15
-rw-r--r--src/mongo/db/s/chunk_move_write_concern_options.h3
-rw-r--r--src/mongo/db/s/cleanup_orphaned_cmd.cpp2
-rw-r--r--src/mongo/db/s/migration_destination_manager_legacy_commands.cpp2
-rw-r--r--src/mongo/db/s/move_chunk_command.cpp2
5 files changed, 18 insertions, 6 deletions
diff --git a/src/mongo/db/s/chunk_move_write_concern_options.cpp b/src/mongo/db/s/chunk_move_write_concern_options.cpp
index 4005e50106c..32ecdaf56dc 100644
--- a/src/mongo/db/s/chunk_move_write_concern_options.cpp
+++ b/src/mongo/db/s/chunk_move_write_concern_options.cpp
@@ -33,7 +33,9 @@
#include "mongo/db/s/chunk_move_write_concern_options.h"
#include "mongo/base/status_with.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator_global.h"
+#include "mongo/db/service_context.h"
#include "mongo/s/migration_secondary_throttle_options.h"
#include "mongo/util/log.h"
@@ -64,8 +66,17 @@ WriteConcernOptions getDefaultWriteConcernForMigration() {
} // namespace
StatusWith<WriteConcernOptions> ChunkMoveWriteConcernOptions::getEffectiveWriteConcern(
- const MigrationSecondaryThrottleOptions& options) {
- if (options.getSecondaryThrottle() == MigrationSecondaryThrottleOptions::kOff) {
+ OperationContext* txn, const MigrationSecondaryThrottleOptions& options) {
+ auto secondaryThrottle = options.getSecondaryThrottle();
+ if (secondaryThrottle == MigrationSecondaryThrottleOptions::kDefault) {
+ if (txn->getServiceContext()->getGlobalStorageEngine()->supportsDocLocking()) {
+ secondaryThrottle = MigrationSecondaryThrottleOptions::kOff;
+ } else {
+ secondaryThrottle = MigrationSecondaryThrottleOptions::kOn;
+ }
+ }
+
+ if (secondaryThrottle == MigrationSecondaryThrottleOptions::kOff) {
return kWriteConcernLocal;
}
diff --git a/src/mongo/db/s/chunk_move_write_concern_options.h b/src/mongo/db/s/chunk_move_write_concern_options.h
index 1ff445d9894..b9734120b2a 100644
--- a/src/mongo/db/s/chunk_move_write_concern_options.h
+++ b/src/mongo/db/s/chunk_move_write_concern_options.h
@@ -35,6 +35,7 @@ namespace mongo {
class MigrationSecondaryThrottleOptions;
template <typename T>
class StatusWith;
+class OperationContext;
/**
* Returns the default write concern for migration cleanup on the donor shard and for cloning
@@ -59,7 +60,7 @@ public:
* concern.
*/
static StatusWith<WriteConcernOptions> getEffectiveWriteConcern(
- const MigrationSecondaryThrottleOptions& options);
+ OperationContext* txn, const MigrationSecondaryThrottleOptions& options);
};
} // namespace mongo
diff --git a/src/mongo/db/s/cleanup_orphaned_cmd.cpp b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
index 9421784b28c..9ea761808ac 100644
--- a/src/mongo/db/s/cleanup_orphaned_cmd.cpp
+++ b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
@@ -228,7 +228,7 @@ public:
const auto secondaryThrottle =
uassertStatusOK(MigrationSecondaryThrottleOptions::createFromCommand(cmdObj));
const auto writeConcern = uassertStatusOK(
- ChunkMoveWriteConcernOptions::getEffectiveWriteConcern(secondaryThrottle));
+ ChunkMoveWriteConcernOptions::getEffectiveWriteConcern(txn, secondaryThrottle));
ShardingState* const shardingState = ShardingState::get(txn);
diff --git a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
index 1d1e5fa40c1..545925f7190 100644
--- a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
+++ b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
@@ -155,7 +155,7 @@ public:
const auto secondaryThrottle =
uassertStatusOK(MigrationSecondaryThrottleOptions::createFromCommand(cmdObj));
const auto writeConcern = uassertStatusOK(
- ChunkMoveWriteConcernOptions::getEffectiveWriteConcern(secondaryThrottle));
+ ChunkMoveWriteConcernOptions::getEffectiveWriteConcern(txn, secondaryThrottle));
BSONObj shardKeyPattern = cmdObj["shardKeyPattern"].Obj().getOwned();
diff --git a/src/mongo/db/s/move_chunk_command.cpp b/src/mongo/db/s/move_chunk_command.cpp
index a3295e974b7..42beb940283 100644
--- a/src/mongo/db/s/move_chunk_command.cpp
+++ b/src/mongo/db/s/move_chunk_command.cpp
@@ -191,7 +191,7 @@ public:
const auto writeConcernForRangeDeleter =
uassertStatusOK(ChunkMoveWriteConcernOptions::getEffectiveWriteConcern(
- moveChunkRequest.getSecondaryThrottle()));
+ txn, moveChunkRequest.getSecondaryThrottle()));
// Make sure we're as up-to-date as possible with shard information. This catches the case
// where we might have changed a shard's host by removing/adding a shard with the same name.