Skip to content

Commit

Permalink
change KeeperContainerService bean name to KeeperContainerCheckerService
Browse files Browse the repository at this point in the history
  • Loading branch information
yifuzhou committed Nov 21, 2024
1 parent 3a7a7a3 commit 6b91e3e
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import java.util.List;

public interface KeeperContainerService {
public interface KeeperContainerCheckerService {

KeeperDiskInfo getKeeperDiskInfo(String keeperContainerIp) throws RestClientException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ctrip.xpipe.redis.checker.impl;

import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import com.ctrip.xpipe.redis.core.entity.KeeperDiskInfo;
import com.ctrip.xpipe.redis.core.entity.KeeperInstanceMeta;
import com.ctrip.xpipe.redis.core.entity.KeeperTransMeta;
Expand All @@ -16,7 +16,7 @@
import java.util.List;

@Service
public class DefaultKeeperContainerService extends AbstractService implements KeeperContainerService {
public class DefaultKeeperContainerService extends AbstractService implements KeeperContainerCheckerService {

private static final String HTTP_PREFIX = "http://";
private static final String PATH_GET_KEEPER_DISK_INFO = "/keepers/disk";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ctrip.xpipe.api.foundation.FoundationService;
import com.ctrip.xpipe.redis.checker.CheckerConsoleService;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import com.ctrip.xpipe.redis.checker.cluster.GroupCheckerLeaderAware;
import com.ctrip.xpipe.redis.checker.config.CheckerConfig;
import com.ctrip.xpipe.redis.checker.healthcheck.actions.keeper.info.RedisUsedMemoryCollector;
Expand Down Expand Up @@ -42,7 +42,7 @@ public class KeeperContainerInfoReporter implements GroupCheckerLeaderAware {

private CheckerConsoleService checkerConsoleService;

private KeeperContainerService keeperContainerService;
private KeeperContainerCheckerService keeperContainerService;

private CheckerConfig config;

Expand All @@ -54,7 +54,7 @@ public class KeeperContainerInfoReporter implements GroupCheckerLeaderAware {


public KeeperContainerInfoReporter(RedisUsedMemoryCollector redisUsedMemoryCollector, CheckerConsoleService
checkerConsoleService, KeeperFlowCollector keeperFlowCollector, CheckerConfig config, KeeperContainerService keeperContainerService, MetaCache metaCache) {
checkerConsoleService, KeeperFlowCollector keeperFlowCollector, CheckerConfig config, KeeperContainerCheckerService keeperContainerService, MetaCache metaCache) {
this.redisUsedMemoryCollector = redisUsedMemoryCollector;
this.keeperFlowCollector = keeperFlowCollector;
this.checkerConsoleService = checkerConsoleService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ctrip.xpipe.api.foundation.FoundationService;
import com.ctrip.xpipe.redis.checker.CheckerConsoleService;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import com.ctrip.xpipe.redis.checker.config.CheckerConfig;
import com.ctrip.xpipe.redis.checker.healthcheck.actions.keeper.info.RedisUsedMemoryCollector;
import com.ctrip.xpipe.redis.checker.healthcheck.actions.keeper.infoStats.KeeperFlowCollector;
Expand Down Expand Up @@ -50,7 +50,7 @@ public class KeeperUsedInfoReporterTest {
CheckerConfig config;

@Mock
KeeperContainerService keeperContainerService;
KeeperContainerCheckerService keeperContainerService;

@Mock
private MetaCache metaCache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.ctrip.xpipe.redis.console.model.KeeperRestElectionModel;
import com.ctrip.xpipe.redis.console.model.MigrationKeeperContainerDetailModel;
import com.ctrip.xpipe.redis.console.service.ConfigService;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

Expand All @@ -32,7 +32,7 @@ public class KeeperContainerController extends AbstractConsoleController{
ConfigService configService;

@Autowired
KeeperContainerService keeperContainerService;
KeeperContainerCheckerService keeperContainerService;

@RequestMapping(value = "/keepercontainer/overload/info/all", method = RequestMethod.GET)
public List<MigrationKeeperContainerDetailModel> getAllReadyToMigrateKeeperContainers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ctrip.xpipe.api.foundation.FoundationService;
import com.ctrip.xpipe.api.monitor.EventMonitor;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import com.ctrip.xpipe.redis.checker.alert.ALERT_TYPE;
import com.ctrip.xpipe.redis.console.AbstractSiteLeaderIntervalAction;
import com.ctrip.xpipe.redis.console.config.ConsoleConfig;
Expand Down Expand Up @@ -34,7 +34,7 @@
public class KeeperContainerDiskIOLimitDispatcher extends AbstractSiteLeaderIntervalAction {

@Autowired
private KeeperContainerService keeperContainerService;
private KeeperContainerCheckerService keeperContainerService;

@Autowired
private MetaCache metaCache;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.ctrip.xpipe.redis.console.keeper.command;

import com.ctrip.xpipe.command.AbstractCommand;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;

public class KeeperResetCommand<T> extends AbstractCommand<T> {

private String activeKeeperIp;

private long shardId;

private KeeperContainerService keeperContainerService;
private KeeperContainerCheckerService keeperContainerService;

public KeeperResetCommand(String activeKeeperIp, long shardId, KeeperContainerService keeperContainerService) {
public KeeperResetCommand(String activeKeeperIp, long shardId, KeeperContainerCheckerService keeperContainerService) {
this.activeKeeperIp = activeKeeperIp;
this.shardId = shardId;
this.keeperContainerService = keeperContainerService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import com.ctrip.xpipe.command.SequenceCommandChain;
import com.ctrip.xpipe.endpoint.DefaultEndPoint;
import com.ctrip.xpipe.pool.XpipeNettyClientKeyedObjectPool;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import com.ctrip.xpipe.redis.console.constant.XPipeConsoleConstant;
import com.ctrip.xpipe.redis.console.exception.DataNotFoundException;
import com.ctrip.xpipe.redis.console.exception.ServerException;
import com.ctrip.xpipe.redis.console.keeper.command.*;
import com.ctrip.xpipe.redis.console.model.*;
import com.ctrip.xpipe.redis.console.repository.AzGroupClusterRepository;
import com.ctrip.xpipe.redis.console.service.*;
import com.ctrip.xpipe.redis.console.service.impl.KeeperContainerServiceImpl;
import com.ctrip.xpipe.redis.console.service.model.ShardModelService;
import com.ctrip.xpipe.utils.ObjectUtils;
import com.ctrip.xpipe.utils.VisibleForTesting;
Expand All @@ -27,7 +27,8 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.console.service.KeeperContainerService;


import javax.annotation.PostConstruct;
import javax.annotation.Resource;
Expand Down Expand Up @@ -56,11 +57,11 @@ public class ShardModelServiceImpl implements ShardModelService{
private ApplierService applierService;
@Autowired
private ReplDirectionService replDirectionService;
@Autowired
private KeeperContainerServiceImpl keeperContainerServiceImpl;
@Autowired
private KeeperContainerService keeperContainerService;
@Autowired
private KeeperContainerCheckerService keeperContainerCheckerService;
@Autowired
private AzGroupClusterRepository azGroupClusterRepository;
@Autowired
private KeeperAdvancedService keeperAdvancedService;
Expand Down Expand Up @@ -128,7 +129,7 @@ public List<ShardModel> getMultiShardModel(final String dcName, final String clu
return shardModels;
}

Map<Long, Long> containerIdDcMap = keeperContainerServiceImpl.keeperContainerIdDcMap();
Map<Long, Long> containerIdDcMap = keeperContainerService.keeperContainerIdDcMap();
for (int i = 0; i < shards.size(); i++) {
ShardTbl shardInfo = shards.get(i);
Future<DcClusterShardTbl> dcClusterShardFuture = dcClusterShardFutures.get(i);
Expand Down Expand Up @@ -284,7 +285,7 @@ public boolean switchActiveKeeper(String activeIp, String backupIp, ShardModel s
keepers.get(0).getRedisIp(), keepers.get(0).getRedisPort(), keepers.get(1).getRedisIp(), keepers.get(1).getRedisPort());
return false;
}
Command<?> switchMasterCommand = retryCommandFactory.createRetryCommand(new KeeperResetCommand<>(activeKeeper.getHost(), shardModel.getShardTbl().getId(), keeperContainerService));
Command<?> switchMasterCommand = retryCommandFactory.createRetryCommand(new KeeperResetCommand<>(activeKeeper.getHost(), shardModel.getShardTbl().getId(), keeperContainerCheckerService));
Command<?> checkKeeperRoleCommand = retryCommandFactory.createRetryCommand(new CheckKeeperActiveCommand<>(keyedObjectPool, scheduled, backUpKeeper, true));
SequenceCommandChain chain = new SequenceCommandChain(false, false);
chain.add(switchMasterCommand);
Expand Down Expand Up @@ -337,7 +338,7 @@ public boolean migrateActiveKeeper(String dcName, String clusterName, ShardModel
return false;
}
Command<?> fullSyncJudgeRetryCommand = retryCommandFactory.createRetryCommand(new FullSyncJudgeCommand<>(keyedObjectPool, scheduled, activeKeeper, backUpKeeper, activeMasterReplOffset));
Command<?> switchmasterCommand = retryCommandFactory.createRetryCommand(new KeeperResetCommand<>(activeKeeper.getHost(), shardModel.getShardTbl().getId(), keeperContainerService));
Command<?> switchmasterCommand = retryCommandFactory.createRetryCommand(new KeeperResetCommand<>(activeKeeper.getHost(), shardModel.getShardTbl().getId(), keeperContainerCheckerService));
Command<?> checkKeeperRoleCommand = retryCommandFactory.createRetryCommand(new CheckKeeperActiveCommand<>(keyedObjectPool, scheduled, backUpKeeper, true));
chain = new SequenceCommandChain(false, false);
chain.add(fullSyncJudgeRetryCommand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ctrip.xpipe.api.foundation.FoundationService;
import com.ctrip.xpipe.redis.checker.*;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import com.ctrip.xpipe.redis.checker.alert.AlertManager;
import com.ctrip.xpipe.redis.checker.cluster.AllCheckerLeaderElector;
import com.ctrip.xpipe.redis.checker.cluster.GroupCheckerLeaderElector;
Expand Down Expand Up @@ -200,7 +200,7 @@ public HealthCheckReporter healthCheckReporter(CheckerConfig checkerConfig, Chec
@Bean
@Profile(AbstractProfile.PROFILE_NAME_PRODUCTION)
public KeeperContainerInfoReporter keeperContainerInfoReporter(RedisUsedMemoryCollector redisUsedMemoryCollector,
CheckerConsoleService checkerConsoleService, KeeperFlowCollector keeperFlowCollector, CheckerConfig config, KeeperContainerService keeperContainerService, MetaCache metaCache) {
CheckerConsoleService checkerConsoleService, KeeperFlowCollector keeperFlowCollector, CheckerConfig config, KeeperContainerCheckerService keeperContainerService, MetaCache metaCache) {
return new KeeperContainerInfoReporter(redisUsedMemoryCollector, checkerConsoleService, keeperFlowCollector, config, keeperContainerService, metaCache);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.ctrip.xpipe.api.sso.LogoutHandler;
import com.ctrip.xpipe.api.sso.UserInfoHolder;
import com.ctrip.xpipe.redis.checker.DcRelationsService;
import com.ctrip.xpipe.redis.checker.KeeperContainerService;
import com.ctrip.xpipe.redis.checker.KeeperContainerCheckerService;
import com.ctrip.xpipe.redis.checker.PersistenceCache;
import com.ctrip.xpipe.redis.checker.config.impl.CheckConfigBean;
import com.ctrip.xpipe.redis.checker.config.impl.CommonConfigBean;
Expand Down Expand Up @@ -191,7 +191,7 @@ public FoundationService foundationService() {
}

@Bean
public KeeperContainerService keeperContainerService() {
public KeeperContainerCheckerService keeperContainerService() {
return new DefaultKeeperContainerService();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
ClusterServiceImplTest.class,
ClusterServiceImplTest2.class,
RedisServiceImplTest.class,
KeeperContainerServiceImplTest.class,
KeeperContainerCheckerServiceImplTest.class,
ShardServiceImplTest.class,
ShardServiceImplTest2.class,
ShardServiceTest2.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DcServiceTest.class,
ClusterServiceTest.class,
ShardServiceTest.class,
KeeperContainerServiceTest.class,
KeeperContainerCheckerServiceTest.class,
SentinelGroupServiceTest.class,
SentinelGroupServiceMockTest.class,
SentinelServiceImplTest.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Sep 26, 2016
*/
@RunWith(MockitoJUnitRunner.class)
public class KeeperContainerServiceTest extends AbstractConsoleTest {
public class KeeperContainerCheckerServiceTest extends AbstractConsoleTest {
@Mock
private KeepercontainerTblDao mockedKeepercontainerTblDao;
@InjectMocks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* <p>
* Apr 06, 2017
*/
public class KeeperContainerServiceImplTest extends AbstractServiceImplTest{
public class KeeperContainerCheckerServiceImplTest extends AbstractServiceImplTest{


@Autowired
Expand Down

0 comments on commit 6b91e3e

Please sign in to comment.