diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-07-29 14:37:22 -0400 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-08-24 11:48:59 -0400 |
commit | 3de973e1fd98473fbf1605e2d6039214aa15b2a4 (patch) | |
tree | 47df21978e84da9afc39140e325f630189fc4286 /src/mongo/db/s/migration_destination_manager_legacy_commands.cpp | |
parent | 30e9b7dba2c530074f1758e43324d1c082ec45ce (diff) | |
download | mongo-3de973e1fd98473fbf1605e2d6039214aa15b2a4.tar.gz |
SERVER-22671 adding migration status to serverStatus' sharding section
Diffstat (limited to 'src/mongo/db/s/migration_destination_manager_legacy_commands.cpp')
-rw-r--r-- | src/mongo/db/s/migration_destination_manager_legacy_commands.cpp | 37 |
1 files changed, 23 insertions, 14 deletions
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 6c528147df9..dca0a9c43bd 100644 --- a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp +++ b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp @@ -126,10 +126,9 @@ public: } } - if (!cmdObj["toShardName"].eoo()) { - dassert(cmdObj["toShardName"].type() == String); - shardingState->setShardName(cmdObj["toShardName"].String()); - } + const ShardId toShard(cmdObj["toShardName"].String()); + shardingState->setShardName(toShard.toString()); + const ShardId fromShard(cmdObj["fromShardName"].String()); const string ns = cmdObj.firstElement().String(); @@ -158,20 +157,30 @@ public: BSONObj shardKeyPattern = cmdObj["shardKeyPattern"].Obj().getOwned(); - const string fromShard(cmdObj["from"].String()); + auto statusWithFromShardConnectionString = ConnectionString::parse(cmdObj["from"].String()); + if (!statusWithFromShardConnectionString.isOK()) { + errmsg = str::stream() << "cannot start recv'ing chunk " + << "[" << min << "," << max << ")" + << causedBy(statusWithFromShardConnectionString.getStatus()); + + warning() << errmsg; + return false; + } const MigrationSessionId migrationSessionId( uassertStatusOK(MigrationSessionId::extractFromBSON(cmdObj))); - Status startStatus = - shardingState->migrationDestinationManager()->start(ns, - migrationSessionId, - fromShard, - min, - max, - shardKeyPattern, - currentVersion.epoch(), - writeConcern); + Status startStatus = shardingState->migrationDestinationManager()->start( + ns, + migrationSessionId, + statusWithFromShardConnectionString.getValue(), + fromShard, + toShard, + min, + max, + shardKeyPattern, + currentVersion.epoch(), + writeConcern); if (!startStatus.isOK()) { return appendCommandStatus(result, startStatus); } |