Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cat log when migrate keepers #749

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class AutoMigrateOverloadKeeperContainerAction extends AbstractCrossDcInt

private final List<ALERT_TYPE> alertType = Lists.newArrayList(ALERT_TYPE.KEEPER_MIGRATION_FAIL, ALERT_TYPE.KEEPER_MIGRATION_SUCCESS);

private final static String KEEPER_MIGRATION_SUCCESS = "keeper_migration_success";
public final static String KEEPER_MIGRATION_SUCCESS = "keeper_migration_success";

private final static String KEEPER_MIGRATION_FAIL = "keeper_migration_fail";
public final static String KEEPER_MIGRATION_FAIL = "keeper_migration_fail";

@Override
protected void doAction() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ctrip.xpipe.redis.console.service.impl;

import com.ctrip.xpipe.monitor.CatEventMonitor;
import com.ctrip.xpipe.redis.checker.model.DcClusterShard;
import com.ctrip.xpipe.redis.console.model.MigrationKeeperContainerDetailModel;
import com.ctrip.xpipe.redis.console.model.ShardModel;
Expand All @@ -16,6 +17,9 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import static com.ctrip.xpipe.redis.console.keeper.AutoMigrateOverloadKeeperContainerAction.KEEPER_MIGRATION_FAIL;
import static com.ctrip.xpipe.redis.console.keeper.AutoMigrateOverloadKeeperContainerAction.KEEPER_MIGRATION_SUCCESS;

@Component
public class DefaultKeeperContainerMigrationService implements KeeperContainerMigrationService {

Expand All @@ -41,7 +45,6 @@
List<DcClusterShard> migrateShards = keeperContainer.getMigrateShards();
if (CollectionUtils.isEmpty(migrateShards)) continue;


String srcKeeperContainerIp = keeperContainer.getSrcKeeperContainer().getKeeperIp();
for (DcClusterShard migrateShard : migrateShards) {
ShardModel shardModel = shardModelService.getShardModel(migrateShard.getDcId(),
Expand All @@ -53,8 +56,16 @@
logger.debug("[beginMigrateKeeperContainers] begin migrate shard {} from srcKeeperContainer:{} to targetKeeperContainer:{}",
migrateShard, srcKeeperContainerIp, keeperContainer.getTargetKeeperContainer().getKeeperIp());
if (shardModelService.migrateShardKeepers(migrateShard.getDcId(), migrateShard.getClusterId(), shardModel,
srcKeeperContainerIp, keeperContainer.getTargetKeeperContainer().getKeeperIp()))
srcKeeperContainerIp, keeperContainer.getTargetKeeperContainer().getKeeperIp())) {
keeperContainer.migrateKeeperCompleteCountIncrease();
CatEventMonitor.DEFAULT.logEvent(KEEPER_MIGRATION_SUCCESS, String.format("dc:%s, cluster:%s, shard:%s, src:%s, target:%s",
migrateShard.getDcId(), migrateShard.getClusterId(), migrateShard.getShardId(), srcKeeperContainerIp,
keeperContainer.getTargetKeeperContainer().getKeeperIp()));
} else {
CatEventMonitor.DEFAULT.logEvent(KEEPER_MIGRATION_FAIL, String.format("dc:%s, cluster:%s, shard:%s, src:%s, target:%s",
migrateShard.getDcId(), migrateShard.getClusterId(), migrateShard.getShardId(), srcKeeperContainerIp,
keeperContainer.getTargetKeeperContainer().getKeeperIp()));

Check warning on line 67 in redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/DefaultKeeperContainerMigrationService.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/DefaultKeeperContainerMigrationService.java#L65-L67

Added lines #L65 - L67 were not covered by tests
}
}
}
isBegin.set(false);
Expand Down
Loading