diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-08-22 12:22:53 -0400 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-08-22 16:46:33 -0400 |
commit | d45804b3bf5c336ab5943bff163d1e0e5fcfd3a6 (patch) | |
tree | 5cf7f40e9bb6fd8e77da4ff0e942d7076d43b5d0 /src/mongo/db/s/migration_source_manager.cpp | |
parent | 753766ba3a1ae49dbc6a472f5d821115b8a37826 (diff) | |
download | mongo-d45804b3bf5c336ab5943bff163d1e0e5fcfd3a6.tar.gz |
SERVER-25686 send all moveChunk commands through to the shard to wait for waitForDelete
Diffstat (limited to 'src/mongo/db/s/migration_source_manager.cpp')
-rw-r--r-- | src/mongo/db/s/migration_source_manager.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index df12472c7bb..3ab23cc406b 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -79,10 +79,13 @@ MigrationSourceManager::MigrationSourceManager(OperationContext* txn, MoveChunkR : _args(std::move(request)), _startTime() { invariant(!txn->lockState()->isLocked()); + // Disallow moving a chunk to ourselves + uassert(ErrorCodes::InvalidOptions, + "Destination shard cannot be the same as source", + _args.getFromShardId() != _args.getToShardId()); + const auto& oss = OperationShardingState::get(txn); - if (!oss.hasShardVersion()) { - uasserted(ErrorCodes::InvalidOptions, "collection version is missing"); - } + uassert(ErrorCodes::InvalidOptions, "collection version is missing", oss.hasShardVersion()); // Even though the moveChunk command transmits a value in the operation's shardVersion field, // this value does not actually contain the shard version, but the global collection version. |