diff options
Diffstat (limited to 'src/mongo')
8 files changed, 8 insertions, 26 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript index 8eb1fad975c..a9e4fca41ee 100644 --- a/src/mongo/db/repl/SConscript +++ b/src/mongo/db/repl/SConscript @@ -690,12 +690,12 @@ env.Library( '$BUILD_DIR/mongo/rpc/metadata', '$BUILD_DIR/mongo/transport/transport_layer_common', '$BUILD_DIR/mongo/util/fail_point', - '$BUILD_DIR/mongo/db/repl/replication_metrics', 'initial_syncer', 'data_replicator_external_state_initial_sync', 'repl_coordinator_interface', 'repl_settings', 'replica_set_messages', + 'replication_metrics', 'replication_process', 'reporter', 'scatter_gather', @@ -705,6 +705,7 @@ env.Library( '$BUILD_DIR/mongo/db/catalog/collection_catalog', '$BUILD_DIR/mongo/db/commands/test_commands_enabled', '$BUILD_DIR/mongo/db/index_builds_coordinator_interface', + '$BUILD_DIR/mongo/db/replica_set_aware_service', '$BUILD_DIR/mongo/idl/server_parameter', 'local_oplog_info', 'repl_server_parameters', @@ -770,7 +771,6 @@ env.Library( 'storage_interface', '$BUILD_DIR/mongo/db/concurrency/lock_manager', '$BUILD_DIR/mongo/db/service_context', - '$BUILD_DIR/mongo/db/replica_set_aware_service', '$BUILD_DIR/mongo/executor/network_interface_mock', ], ) @@ -1203,7 +1203,6 @@ env.Library( LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/db/commands/mongod_fcv', '$BUILD_DIR/mongo/db/index_builds_coordinator_interface', - '$BUILD_DIR/mongo/db/replica_set_aware_service', '$BUILD_DIR/mongo/db/storage/flow_control', '$BUILD_DIR/mongo/db/storage/storage_control', 'local_oplog_info', diff --git a/src/mongo/db/repl/replication_coordinator_external_state.h b/src/mongo/db/repl/replication_coordinator_external_state.h index 20268bfe67a..29cc6dd9c5b 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state.h +++ b/src/mongo/db/repl/replication_coordinator_external_state.h @@ -228,11 +228,6 @@ public: virtual void onStepDownHook() = 0; /** - * Called after this node has become an arbiter. - */ - virtual void onBecomeArbiterHook() = 0; - - /** * Notifies the bgsync and syncSourceFeedback threads to choose a new sync source. */ virtual void signalApplierToChooseNewSyncSource() = 0; diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp index ef6d9d0c50c..4d22c88506e 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp @@ -76,7 +76,6 @@ #include "mongo/db/repl/replication_metrics.h" #include "mongo/db/repl/replication_process.h" #include "mongo/db/repl/storage_interface.h" -#include "mongo/db/replica_set_aware_service.h" #include "mongo/db/s/balancer/balancer.h" #include "mongo/db/s/chunk_splitter.h" #include "mongo/db/s/config/sharding_catalog_manager.h" @@ -468,8 +467,6 @@ void ReplicationCoordinatorExternalStateImpl::onDrainComplete(OperationContext* if (_oplogBuffer) { _oplogBuffer->exitDrainMode(); } - - ReplicaSetAwareServiceRegistry::get(_service).onStepUpBegin(opCtx); } OpTime ReplicationCoordinatorExternalStateImpl::onTransitionToPrimary(OperationContext* opCtx) { @@ -535,7 +532,6 @@ OpTime ReplicationCoordinatorExternalStateImpl::onTransitionToPrimary(OperationC replCoord->createWMajorityWriteAvailabilityDateWaiter(opTimeToReturn); _shardingOnTransitionToPrimaryHook(opCtx); - ReplicaSetAwareServiceRegistry::get(_service).onStepUpComplete(opCtx); _dropAllTempCollections(opCtx); @@ -757,16 +753,11 @@ void ReplicationCoordinatorExternalStateImpl::closeConnections() { } void ReplicationCoordinatorExternalStateImpl::onStepDownHook() { - ReplicaSetAwareServiceRegistry::get(_service).onStepDown(); _shardingOnStepDownHook(); stopNoopWriter(); _stopAsyncUpdatesOfAndClearOplogTruncateAfterPoint(); } -void ReplicationCoordinatorExternalStateImpl::onBecomeArbiterHook() { - ReplicaSetAwareServiceRegistry::get(_service).onBecomeArbiter(); -} - void ReplicationCoordinatorExternalStateImpl::_shardingOnStepDownHook() { if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { PeriodicShardedIndexConsistencyChecker::get(_service).onStepDown(); diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.h b/src/mongo/db/repl/replication_coordinator_external_state_impl.h index 47c03a36d69..f38aee76a39 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.h @@ -98,7 +98,6 @@ public: virtual HostAndPort getClientHostAndPort(const OperationContext* opCtx); virtual void closeConnections(); virtual void onStepDownHook(); - virtual void onBecomeArbiterHook(); virtual void signalApplierToChooseNewSyncSource(); virtual void stopProducer(); virtual void startProducerIfStopped(); diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp b/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp index 9f0053fb001..4c9ddbaf7f1 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp @@ -40,7 +40,6 @@ #include "mongo/db/client.h" #include "mongo/db/jsobj.h" #include "mongo/db/repl/oplog_buffer_blocking_queue.h" -#include "mongo/db/replica_set_aware_service.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/sequence_util.h" @@ -236,10 +235,6 @@ void ReplicationCoordinatorExternalStateMock::closeConnections() { void ReplicationCoordinatorExternalStateMock::onStepDownHook() {} -void ReplicationCoordinatorExternalStateMock::onBecomeArbiterHook() { - ReplicaSetAwareServiceRegistry::get(getGlobalServiceContext()).onBecomeArbiter(); -} - void ReplicationCoordinatorExternalStateMock::signalApplierToChooseNewSyncSource() {} void ReplicationCoordinatorExternalStateMock::stopProducer() {} diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.h b/src/mongo/db/repl/replication_coordinator_external_state_mock.h index e195daae551..fd867df8ac7 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h @@ -87,7 +87,6 @@ public: virtual StatusWith<OpTimeAndWallTime> loadLastOpTimeAndWallTime(OperationContext* opCtx); virtual void closeConnections(); virtual void onStepDownHook(); - virtual void onBecomeArbiterHook(); virtual void signalApplierToChooseNewSyncSource(); virtual void stopProducer(); virtual void startProducerIfStopped(); diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 4ef8276e08f..c82539b42ba 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -655,7 +655,7 @@ void ReplicationCoordinatorImpl::_finishLoadLocalConfig( lastOpTimeAndWallTime = lastOpTimeAndWallTimeStatus.getValue(); } } else { - _externalState->onBecomeArbiterHook(); + ReplicaSetAwareServiceRegistry::get(_service).onBecomeArbiter(); } const auto lastOpTime = lastOpTimeAndWallTime.opTime; @@ -1153,6 +1153,7 @@ void ReplicationCoordinatorImpl::signalDrainComplete(OperationContext* opCtx, lk.unlock(); _externalState->onDrainComplete(opCtx); + ReplicaSetAwareServiceRegistry::get(_service).onStepUpBegin(opCtx); if (MONGO_unlikely(hangBeforeRSTLOnDrainComplete.shouldFail())) { LOGV2(4712800, "Hanging due to hangBeforeRSTLOnDrainComplete failpoint"); @@ -1227,6 +1228,7 @@ void ReplicationCoordinatorImpl::signalDrainComplete(OperationContext* opCtx, AllowNonLocalWritesBlock writesAllowed(opCtx); OpTime firstOpTime = _externalState->onTransitionToPrimary(opCtx); + ReplicaSetAwareServiceRegistry::get(_service).onStepUpComplete(opCtx); lk.lock(); auto status = _topCoord->completeTransitionToPrimary(firstOpTime); @@ -4169,6 +4171,7 @@ void ReplicationCoordinatorImpl::_performPostMemberStateUpdateAction( /* FALLTHROUGH */ case kActionSteppedDown: _externalState->onStepDownHook(); + ReplicaSetAwareServiceRegistry::get(_service).onStepDown(); break; case kActionStartSingleNodeElection: _startElectSelfIfEligibleV1(StartElectionReasonEnum::kElectionTimeout); diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp index 694b1e7647f..e7c7bcf4b1f 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp @@ -55,6 +55,7 @@ #include "mongo/db/repl/replication_process.h" #include "mongo/db/repl/topology_coordinator.h" #include "mongo/db/repl/vote_requester.h" +#include "mongo/db/replica_set_aware_service.h" #include "mongo/db/service_context.h" #include "mongo/logv2/log.h" #include "mongo/platform/mutex.h" @@ -686,7 +687,7 @@ void ReplicationCoordinatorImpl::_heartbeatReconfigStore( newConfig.getMemberAt(myIndex.getValue()).isArbiter(); if (isArbiter) { - _externalState->onBecomeArbiterHook(); + ReplicaSetAwareServiceRegistry::get(_service).onBecomeArbiter(); } if (!isArbiter && isFirstConfig) { |