diff options
author | jannaerin <golden.janna@gmail.com> | 2018-08-27 15:52:32 -0400 |
---|---|---|
committer | jannaerin <golden.janna@gmail.com> | 2018-09-21 16:09:29 -0400 |
commit | f66c37783f6b7f32759cf4bc4ac8f49688ccea97 (patch) | |
tree | dd829b7181e108ae28a58242b583635a7772dee5 | |
parent | 4d492e3be2ea9e63fb2d26aad621b0f2a072fe99 (diff) | |
download | mongo-f66c37783f6b7f32759cf4bc4ac8f49688ccea97.tar.gz |
SERVER-36130 Verify shardId rather than connection string during migration
(cherry picked from commit 1ee551653a1ff9c154d94e59c429529eb3ea9098)
-rw-r--r-- | src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/s/migration_destination_manager.cpp | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp index 51eab4f8477..0f4734d2321 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp @@ -307,9 +307,11 @@ Status MigrationChunkClonerSourceLegacy::awaitUntilCriticalSectionIsAppropriate( } if (res["ns"].str() != _args.getNss().ns() || - res["from"].str() != _donorConnStr.toString() || !res["min"].isABSONObj() || - res["min"].Obj().woCompare(_args.getMinKey()) != 0 || !res["max"].isABSONObj() || - res["max"].Obj().woCompare(_args.getMaxKey()) != 0 || + (res.hasField("fromShardId") + ? (res["fromShardId"].str() != _args.getFromShardId().toString()) + : (res["from"].str() != _donorConnStr.toString())) || + !res["min"].isABSONObj() || res["min"].Obj().woCompare(_args.getMinKey()) != 0 || + !res["max"].isABSONObj() || res["max"].Obj().woCompare(_args.getMaxKey()) != 0 || !_sessionId.matches(migrationSessionIdStatus.getValue())) { // This can happen when the destination aborted the migration and received another // recvChunk before this thread sees the transition to the abort state. This is diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index 4f378685efc..90b5b4263a6 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -288,6 +288,7 @@ void MigrationDestinationManager::report(BSONObjBuilder& b, b.append("ns", _nss.ns()); b.append("from", _fromShardConnString.toString()); + b.append("fromShardId", _fromShard.toString()); b.append("min", _min); b.append("max", _max); b.append("shardKeyPattern", _shardKeyPattern); |