Skip to content

Commit

Permalink
alert for keeper dead
Browse files Browse the repository at this point in the history
  • Loading branch information
lishanglin committed Dec 22, 2023
1 parent 145812c commit b43b217
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.ctrip.xpipe.api.command.CommandFutureListener;
import com.ctrip.xpipe.api.endpoint.Endpoint;
import com.ctrip.xpipe.api.lifecycle.TopElement;
import com.ctrip.xpipe.api.monitor.EventMonitor;
import com.ctrip.xpipe.api.pool.SimpleKeyedObjectPool;
import com.ctrip.xpipe.cluster.ClusterType;
import com.ctrip.xpipe.cluster.Hints;
Expand Down Expand Up @@ -81,6 +82,8 @@ public class DefaultKeeperManager extends AbstractCurrentMetaObserver implements

private ExecutorService executors;

private static final String KEEPER_MISMATCH_EVENT = "keeperMismatch";

@Override
protected void doInitialize() throws Exception {
super.doInitialize();
Expand Down Expand Up @@ -193,11 +196,13 @@ protected void doCheckShard(ClusterMeta clusterMeta, ShardMeta shardMeta) {

if (deadKeepers.size() > 0) {
logger.info("[doCheck][dead keepers]{}", deadKeepers);
EventMonitor.DEFAULT.logEvent(KEEPER_MISMATCH_EVENT, String.format("[dead]cluster_%d,shard_%d", clusterDbId, shardDbId));
addDeadKeepers(deadKeepers, clusterDbId, shardDbId);
}

if (deadKeepers.size() == 0 && removedKeepers.size() > 0) {
logger.info("[doCheck][removed keepers]{}", removedKeepers);
EventMonitor.DEFAULT.logEvent(KEEPER_MISMATCH_EVENT, String.format("[redundant]cluster_%d,shard_%d", clusterDbId, shardDbId));
removeRemovedKeepers(removedKeepers, clusterDbId, shardDbId);
}

Expand Down

0 comments on commit b43b217

Please sign in to comment.