diff options
author | Antonio Fuschetto <antonio.fuschetto@mongodb.com> | 2022-11-18 17:14:58 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-18 18:31:45 +0000 |
commit | fd4b7825b5339e6612fef642da3d6c6fb702d681 (patch) | |
tree | 87d03bb67e258f11bb7b11ca650d7c00c46adcf6 /src | |
parent | 450ed089e466ccb74eb6b7eb37dba6cd41956c73 (diff) | |
download | mongo-fd4b7825b5339e6612fef642da3d6c6fb702d681.tar.gz |
SERVER-71200 Add NoResilient suffix to movePrimary coordinator
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/db/s/move_primary_coordinator_no_resilient.cpp (renamed from src/mongo/db/s/move_primary_coordinator.cpp) | 8 | ||||
-rw-r--r-- | src/mongo/db/s/move_primary_coordinator_no_resilient.h (renamed from src/mongo/db/s/move_primary_coordinator.h) | 8 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_ddl_coordinator_service.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/s/shardsvr_move_primary_command.cpp | 5 |
5 files changed, 16 insertions, 12 deletions
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript index 3fee5b331b0..5c62545009b 100644 --- a/src/mongo/db/s/SConscript +++ b/src/mongo/db/s/SConscript @@ -477,7 +477,7 @@ env.Library( 'migration_chunk_cloner_source_legacy_commands.cpp', 'migration_destination_manager_legacy_commands.cpp', 'move_primary_coordinator_document.idl', - 'move_primary_coordinator.cpp', + 'move_primary_coordinator_no_resilient.cpp', 'refine_collection_shard_key_coordinator_document.idl', 'refine_collection_shard_key_coordinator.cpp', 'refresh_query_analyzer_configuration_cmd.cpp', diff --git a/src/mongo/db/s/move_primary_coordinator.cpp b/src/mongo/db/s/move_primary_coordinator_no_resilient.cpp index a19a5ebb286..420b96e549d 100644 --- a/src/mongo/db/s/move_primary_coordinator.cpp +++ b/src/mongo/db/s/move_primary_coordinator_no_resilient.cpp @@ -30,7 +30,7 @@ #include "mongo/platform/basic.h" -#include "mongo/db/s/move_primary_coordinator.h" +#include "mongo/db/s/move_primary_coordinator_no_resilient.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/s/move_primary_source_manager.h" @@ -46,12 +46,12 @@ namespace mongo { -void MovePrimaryCoordinator::appendCommandInfo(BSONObjBuilder* cmdInfoBuilder) const { +void MovePrimaryCoordinatorNoResilient::appendCommandInfo(BSONObjBuilder* cmdInfoBuilder) const { stdx::lock_guard lk{_docMutex}; cmdInfoBuilder->append("request", BSON(_doc.kToShardIdFieldName << _doc.getToShardId())); }; -void MovePrimaryCoordinator::checkIfOptionsConflict(const BSONObj& doc) const { +void MovePrimaryCoordinatorNoResilient::checkIfOptionsConflict(const BSONObj& doc) const { // If we have two shard collections on the same namespace, then the arguments must be the same. const auto otherDoc = MovePrimaryCoordinatorDocument::parse( IDLParserContext("MovePrimaryCoordinatorDocument"), doc); @@ -63,7 +63,7 @@ void MovePrimaryCoordinator::checkIfOptionsConflict(const BSONObj& doc) const { } -ExecutorFuture<void> MovePrimaryCoordinator::_runImpl( +ExecutorFuture<void> MovePrimaryCoordinatorNoResilient::_runImpl( std::shared_ptr<executor::ScopedTaskExecutor> executor, const CancellationToken& token) noexcept { return ExecutorFuture<void>(**executor) diff --git a/src/mongo/db/s/move_primary_coordinator.h b/src/mongo/db/s/move_primary_coordinator_no_resilient.h index 80a1586e0a4..32b26b9781d 100644 --- a/src/mongo/db/s/move_primary_coordinator.h +++ b/src/mongo/db/s/move_primary_coordinator_no_resilient.h @@ -35,13 +35,15 @@ namespace mongo { -class MovePrimaryCoordinator final +// TODO (SERVER-71309): Remove once 7.0 becomes last LTS. +class MovePrimaryCoordinatorNoResilient final : public ShardingDDLCoordinatorImpl<MovePrimaryCoordinatorDocument> { public: - MovePrimaryCoordinator(ShardingDDLCoordinatorService* service, const BSONObj& initialState) + MovePrimaryCoordinatorNoResilient(ShardingDDLCoordinatorService* service, + const BSONObj& initialState) : ShardingDDLCoordinatorImpl(service, "MovePrimaryCoordinator", initialState) {} - ~MovePrimaryCoordinator() = default; + ~MovePrimaryCoordinatorNoResilient() = default; void checkIfOptionsConflict(const BSONObj& coorDoc) const override; diff --git a/src/mongo/db/s/sharding_ddl_coordinator_service.cpp b/src/mongo/db/s/sharding_ddl_coordinator_service.cpp index 9d5e2bbd286..b0a62fae3ad 100644 --- a/src/mongo/db/s/sharding_ddl_coordinator_service.cpp +++ b/src/mongo/db/s/sharding_ddl_coordinator_service.cpp @@ -40,7 +40,7 @@ #include "mongo/db/s/database_sharding_state.h" #include "mongo/db/s/drop_collection_coordinator.h" #include "mongo/db/s/drop_database_coordinator.h" -#include "mongo/db/s/move_primary_coordinator.h" +#include "mongo/db/s/move_primary_coordinator_no_resilient.h" #include "mongo/db/s/operation_sharding_state.h" #include "mongo/db/s/refine_collection_shard_key_coordinator.h" #include "mongo/db/s/rename_collection_coordinator.h" @@ -62,7 +62,8 @@ std::shared_ptr<ShardingDDLCoordinator> constructShardingDDLCoordinatorInstance( 5390510, "Constructing new sharding DDL coordinator", "coordinatorDoc"_attr = op.toBSON()); switch (op.getId().getOperationType()) { case DDLCoordinatorTypeEnum::kMovePrimary: - return std::make_shared<MovePrimaryCoordinator>(service, std::move(initialState)); + return std::make_shared<MovePrimaryCoordinatorNoResilient>(service, + std::move(initialState)); break; case DDLCoordinatorTypeEnum::kDropDatabase: return std::make_shared<DropDatabaseCoordinator>(service, std::move(initialState)); diff --git a/src/mongo/db/s/shardsvr_move_primary_command.cpp b/src/mongo/db/s/shardsvr_move_primary_command.cpp index f1f59c5423f..1fc370ac722 100644 --- a/src/mongo/db/s/shardsvr_move_primary_command.cpp +++ b/src/mongo/db/s/shardsvr_move_primary_command.cpp @@ -32,7 +32,7 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" -#include "mongo/db/s/move_primary_coordinator.h" +#include "mongo/db/s/move_primary_coordinator_no_resilient.h" #include "mongo/db/s/sharding_state.h" #include "mongo/s/grid.h" #include "mongo/s/request_types/move_primary_gen.h" @@ -119,6 +119,7 @@ public: ON_BLOCK_EXIT( [opCtx, dbNss] { Grid::get(opCtx)->catalogCache()->purgeDatabase(dbNss.db()); }); + // TODO (SERVER-71309): Remove once 7.0 becomes last LTS. if (!feature_flags::gResilientMovePrimary.isEnabled( serverGlobalParams.featureCompatibility)) { auto coordinatorDoc = MovePrimaryCoordinatorDocument(); @@ -127,7 +128,7 @@ public: coordinatorDoc.setToShardId(toShard.toString()); auto service = ShardingDDLCoordinatorService::getService(opCtx); - auto movePrimaryCoordinator = checked_pointer_cast<MovePrimaryCoordinator>( + auto movePrimaryCoordinator = checked_pointer_cast<MovePrimaryCoordinatorNoResilient>( service->getOrCreateInstance(opCtx, coordinatorDoc.toBSON())); movePrimaryCoordinator->getCompletionFuture().get(opCtx); |