diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-01-06 17:37:54 -0500 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-01-10 10:46:43 -0500 |
commit | b9ecd13e8bee07dea88e908d8e8d2f12239f1879 (patch) | |
tree | bd84cda949af376ecb0825016d4880745c2f9c62 | |
parent | 739d1efecf53f01f9e2f64d4302fbf3d752db7ab (diff) | |
download | mongo-b9ecd13e8bee07dea88e908d8e8d2f12239f1879.tar.gz |
SERVER-27510 remove chunk version check in moveChunk and splitChunk
-rw-r--r-- | src/mongo/db/s/collection_metadata.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/s/collection_metadata.h | 4 | ||||
-rw-r--r-- | src/mongo/db/s/migration_source_manager.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/s/split_chunk_command.cpp | 13 |
4 files changed, 1 insertions, 28 deletions
diff --git a/src/mongo/db/s/collection_metadata.cpp b/src/mongo/db/s/collection_metadata.cpp index de872578c61..b2c19420643 100644 --- a/src/mongo/db/s/collection_metadata.cpp +++ b/src/mongo/db/s/collection_metadata.cpp @@ -246,15 +246,6 @@ Status CollectionMetadata::checkChunkIsValid(const ChunkType& chunk) { << getCollVersion().toString()}; } - if (chunk.isVersionSet() && !chunk.getVersion().isStrictlyEqualTo(existingChunk.getVersion())) { - return {ErrorCodes::IncompatibleShardingMetadata, - str::stream() << "Chunk with the specified bounds exists but the version does not " - "match. Expected: " - << chunk.getVersion().toString() - << ", actual: " - << existingChunk.getVersion().toString()}; - } - return Status::OK(); } diff --git a/src/mongo/db/s/collection_metadata.h b/src/mongo/db/s/collection_metadata.h index b3c1c92a6d0..a8c8d54de20 100644 --- a/src/mongo/db/s/collection_metadata.h +++ b/src/mongo/db/s/collection_metadata.h @@ -114,9 +114,7 @@ public: bool getDifferentChunk(const BSONObj& chunkMinKey, ChunkType* differentChunk) const; /** - * Validates that the passed-in chunk's bounds exactly match a chunk in the metadata cache. If - * the chunk's version has been set as well (it might not be in the case of request coming from - * a 3.2 shard), also ensures that the versions are the same. + * Validates that the passed-in chunk's bounds exactly match a chunk in the metadata cache. */ Status checkChunkIsValid(const ChunkType& chunk); diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index 5a649de1bb3..f5ab20c0e37 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -151,9 +151,6 @@ MigrationSourceManager::MigrationSourceManager(OperationContext* txn, ChunkType chunkToMove; chunkToMove.setMin(_args.getMinKey()); chunkToMove.setMax(_args.getMaxKey()); - if (_args.hasChunkVersion()) { - chunkToMove.setVersion(_args.getChunkVersion()); - } Status chunkValidateStatus = _collectionMetadata->checkChunkIsValid(chunkToMove); if (!chunkValidateStatus.isOK()) { diff --git a/src/mongo/db/s/split_chunk_command.cpp b/src/mongo/db/s/split_chunk_command.cpp index 71d29ff6096..756550572a4 100644 --- a/src/mongo/db/s/split_chunk_command.cpp +++ b/src/mongo/db/s/split_chunk_command.cpp @@ -202,15 +202,6 @@ public: const BSONObj min = chunkRange.getMin(); const BSONObj max = chunkRange.getMax(); - boost::optional<ChunkVersion> expectedChunkVersion; - auto statusWithChunkVersion = - ChunkVersion::parseFromBSONWithFieldForCommands(cmdObj, kChunkVersion); - if (statusWithChunkVersion.isOK()) { - expectedChunkVersion = std::move(statusWithChunkVersion.getValue()); - } else if (statusWithChunkVersion != ErrorCodes::NoSuchKey) { - uassertStatusOK(statusWithChunkVersion); - } - vector<BSONObj> splitKeys; { BSONElement splitKeysElem; @@ -329,10 +320,6 @@ public: ChunkType chunkToMove; chunkToMove.setMin(min); chunkToMove.setMax(max); - if (expectedChunkVersion) { - chunkToMove.setVersion(*expectedChunkVersion); - } - uassertStatusOK(collMetadata->checkChunkIsValid(chunkToMove)); } |