summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2018-08-27 15:52:32 -0400
committerjannaerin <golden.janna@gmail.com>2018-08-28 17:14:09 -0400
commit1ee551653a1ff9c154d94e59c429529eb3ea9098 (patch)
tree286a1f8ef433a7d369dc1fbd190f2a1164b4ef5f
parent9b45c3bb604a5ac661383a75ab1a94d9f8b1d8df (diff)
downloadmongo-1ee551653a1ff9c154d94e59c429529eb3ea9098.tar.gz
SERVER-36130 Verify shardId rather than connection string during migration
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp8
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp1
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 b69d410a356..eab53fb6c22 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
@@ -281,9 +281,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 9d9d4842374..f0574084861 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -290,6 +290,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);