diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-07-20 17:55:23 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-07-27 08:12:42 -0400 |
commit | 22eff747e1e2408cb30f286751c47965e909c5b1 (patch) | |
tree | 02c6f15ec953564799233d15abe5bf68e5497a4a /src/mongo/db/s | |
parent | aa68a612d312db2f13ab674d954cb3d7e239dfa9 (diff) | |
download | mongo-22eff747e1e2408cb30f286751c47965e909c5b1.tar.gz |
SERVER-24856 Make manual moveChunk requests go through the balancer on CSRS primary
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r-- | src/mongo/db/s/active_migrations_registry.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/migration_destination_manager_legacy_commands.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_state.cpp | 7 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/mongo/db/s/active_migrations_registry.cpp b/src/mongo/db/s/active_migrations_registry.cpp index 62d9d287f5a..70e69a05f66 100644 --- a/src/mongo/db/s/active_migrations_registry.cpp +++ b/src/mongo/db/s/active_migrations_registry.cpp @@ -55,7 +55,7 @@ StatusWith<ScopedRegisterMigration> ActiveMigrationsRegistry::registerMigration( return {ErrorCodes::ConflictingOperationInProgress, str::stream() - << "Unable start new migration, because there is already an active migration for " + << "Unable start new migration because this shard is currently donating chunk for " << _activeMoveChunkState->args.getNss().ns()}; } 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 545925f7190..6c528147df9 100644 --- a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp +++ b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp @@ -95,10 +95,9 @@ public: // Active state of TO-side migrations (MigrateStatus) is serialized by distributed // collection lock. - if (shardingState->migrationDestinationManager()->isActive()) { - errmsg = "migrate already in progress"; - return false; - } + uassert(ErrorCodes::ConflictingOperationInProgress, + "Shard is already serving as a destination for migration", + !shardingState->migrationDestinationManager()->isActive()); // Pending deletes (for migrations) are serialized by the distributed collection lock, // we are sure we registered a delete for a range *before* we can migrate-in a diff --git a/src/mongo/db/s/sharding_state.cpp b/src/mongo/db/s/sharding_state.cpp index 999f74a6be0..b1982ee4f58 100644 --- a/src/mongo/db/s/sharding_state.cpp +++ b/src/mongo/db/s/sharding_state.cpp @@ -659,6 +659,13 @@ StatusWith<ChunkVersion> ShardingState::_refreshMetadata( } StatusWith<ScopedRegisterMigration> ShardingState::registerMigration(const MoveChunkRequest& args) { + if (_migrationDestManager.isActive()) { + return { + ErrorCodes::ConflictingOperationInProgress, + str::stream() + << "Unable start new migration because this shard is currently receiving a chunk"}; + } + return _activeMigrationsRegistry.registerMigration(args); } |