diff options
author | Sarah Zhou <sarah.zhou@10gen.com> | 2018-06-07 12:04:15 -0400 |
---|---|---|
committer | Sarah Zhou <sarah.zhou@10gen.com> | 2018-06-07 13:39:07 -0400 |
commit | 20941042dbabb40557ddf61c73f38cdc7e67abec (patch) | |
tree | c3957482af973b71339d5e13b5aff94d9c408c23 /src/mongo/s | |
parent | 019e11c9befaf24a6f248dbf3d904a231db8d97e (diff) | |
download | mongo-20941042dbabb40557ddf61c73f38cdc7e67abec.tar.gz |
SERVER-35209 Remove unused controlChunk parameter in _configsvrCommitChunkMigration
Diffstat (limited to 'src/mongo/s')
3 files changed, 0 insertions, 68 deletions
diff --git a/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp b/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp index afc887745f0..d5d65398b91 100644 --- a/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp +++ b/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp @@ -51,47 +51,6 @@ const auto kKey3 = BSON("Key" << 50); const char kConfigSvrCommitChunkMigration[] = "_configsvrCommitChunkMigration"; -TEST(CommitChunkMigrationRequest, WithControlChunk) { - BSONObjBuilder builder; - - ChunkVersion fromShardCollectionVersion(1, 2, OID::gen()); - - ChunkType migratedChunk; - migratedChunk.setMin(kKey0); - migratedChunk.setMax(kKey1); - - ChunkType controlChunk; - controlChunk.setMin(kKey2); - controlChunk.setMax(kKey3); - boost::optional<ChunkType> controlChunkOpt = controlChunk; - - Timestamp validAfter{1}; - - CommitChunkMigrationRequest::appendAsCommand(&builder, - kNamespaceString, - kShardId0, - kShardId1, - migratedChunk, - controlChunkOpt, - fromShardCollectionVersion, - validAfter); - - BSONObj cmdObj = builder.obj(); - - auto request = assertGet(CommitChunkMigrationRequest::createFromCommand( - NamespaceString(cmdObj[kConfigSvrCommitChunkMigration].String()), cmdObj)); - - ASSERT_EQ(kNamespaceString, request.getNss()); - ASSERT_EQ(kShardId0, request.getFromShard()); - ASSERT_EQ(kShardId1, request.getToShard()); - ASSERT_BSONOBJ_EQ(kKey0, request.getMigratedChunk().getMin()); - ASSERT_BSONOBJ_EQ(kKey1, request.getMigratedChunk().getMax()); - ASSERT(request.getControlChunk()); - ASSERT_BSONOBJ_EQ(kKey2, request.getControlChunk()->getMin()); - ASSERT_BSONOBJ_EQ(kKey3, request.getControlChunk()->getMax()); - ASSERT_EQ(fromShardCollectionVersion.epoch(), request.getCollectionEpoch()); -} - TEST(CommitChunkMigrationRequest, WithoutControlChunk) { BSONObjBuilder builder; @@ -108,7 +67,6 @@ TEST(CommitChunkMigrationRequest, WithoutControlChunk) { kShardId0, kShardId1, migratedChunk, - boost::none, fromShardCollectionVersion, validAfter); @@ -122,7 +80,6 @@ TEST(CommitChunkMigrationRequest, WithoutControlChunk) { ASSERT_EQ(kShardId1, request.getToShard()); ASSERT_BSONOBJ_EQ(kKey0, request.getMigratedChunk().getMin()); ASSERT_BSONOBJ_EQ(kKey1, request.getMigratedChunk().getMax()); - ASSERT(!request.getControlChunk()); ASSERT_EQ(fromShardCollectionVersion.epoch(), request.getCollectionEpoch()); } diff --git a/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp b/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp index 463ee0d4a92..7800657e5cf 100644 --- a/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp +++ b/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp @@ -39,7 +39,6 @@ const char kConfigSvrCommitChunkMigration[] = "_configsvrCommitChunkMigration"; const char kFromShard[] = "fromShard"; const char kToShard[] = "toShard"; const char kMigratedChunk[] = "migratedChunk"; -const char kControlChunk[] = "controlChunk"; const char kFromShardCollectionVersion[] = "fromShardCollectionVersion"; const char kValidAfter[] = "validAfter"; @@ -112,18 +111,6 @@ StatusWith<CommitChunkMigrationRequest> CommitChunkMigrationRequest::createFromC } { - // controlChunk is optional, so parse it if present. - if (obj.hasField(kControlChunk)) { - auto controlChunk = extractChunk(obj, kControlChunk); - if (!controlChunk.isOK()) { - return controlChunk.getStatus(); - } - - request._controlChunk = std::move(controlChunk.getValue()); - } - } - - { auto statusWithChunkVersion = ChunkVersion::parseFromBSONWithFieldForCommands(obj, kFromShardCollectionVersion); if (!statusWithChunkVersion.isOK()) { @@ -155,7 +142,6 @@ void CommitChunkMigrationRequest::appendAsCommand(BSONObjBuilder* builder, const ShardId& fromShard, const ShardId& toShard, const ChunkType& migratedChunk, - const boost::optional<ChunkType>& controlChunk, const ChunkVersion& fromShardCollectionVersion, const Timestamp& validAfter) { invariant(builder->asTempObj().isEmpty()); @@ -167,9 +153,6 @@ void CommitChunkMigrationRequest::appendAsCommand(BSONObjBuilder* builder, builder->append(kMigratedChunk, migratedChunk.toConfigBSON()); fromShardCollectionVersion.appendWithFieldForCommands(builder, kFromShardCollectionVersion); - if (controlChunk) { - builder->append(kControlChunk, controlChunk->toConfigBSON()); - } builder->append(kValidAfter, validAfter); } diff --git a/src/mongo/s/request_types/commit_chunk_migration_request_type.h b/src/mongo/s/request_types/commit_chunk_migration_request_type.h index c7cd1a2bd2d..bd56049ba83 100644 --- a/src/mongo/s/request_types/commit_chunk_migration_request_type.h +++ b/src/mongo/s/request_types/commit_chunk_migration_request_type.h @@ -59,7 +59,6 @@ struct CommitChunkMigrationRequest { const ShardId& fromShard, const ShardId& toShard, const ChunkType& migratedChunkType, - const boost::optional<ChunkType>& controlChunkType, const ChunkVersion& fromShardChunkVersion, const Timestamp& validAfter); @@ -75,9 +74,6 @@ struct CommitChunkMigrationRequest { const ChunkType& getMigratedChunk() const { return _migratedChunk; } - const boost::optional<ChunkType>& getControlChunk() const { - return _controlChunk; - } const OID& getCollectionEpoch() { return _collectionEpoch; } @@ -97,10 +93,6 @@ struct CommitChunkMigrationRequest { // The chunk being moved. ChunkType _migratedChunk; - // TODO: SERVER-35209 Remove after v4.0, kept around for backwards compatibility. - // A chunk on the shard moved from, if any remain. - boost::optional<ChunkType> _controlChunk; - OID _collectionEpoch; // The time of the move |