Skip to content

Commit

Permalink
修复checker检测keeperContainer时的一个bug (#767)
Browse files Browse the repository at this point in the history
Co-authored-by: yifuzhou <[email protected]>
  • Loading branch information
passerbyzed and yifuzhou authored Jan 10, 2024
1 parent f9bb25f commit 807df4a
Showing 1 changed file with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,16 @@ public void notLeader() {
public void reportKeeperContainerInfo() {
try {
logger.debug("[reportKeeperContainerInfo] start");
Map<String, Map<DcClusterShardActive, Long>> hostPort2InputFlow = keeperFlowCollector.getHostPort2InputFlow();
Map<String, Map<DcClusterShardActive, Long>> collectedInfos = keeperFlowCollector.getHostPort2InputFlow();
Map<String, Map<DcClusterShardActive, Long>> hostPort2InputFlow = new HashMap<>();
for (DcMeta dcMeta : metaCache.getXpipeMeta().getDcs().values()) {
if (CURRENT_IDC.equalsIgnoreCase(dcMeta.getId())) {
List<String> ipList = dcMeta.getKeeperContainers().stream()
.map(KeeperContainerMeta::getIp)
.collect(Collectors.toList());
logger.info("[reportKeeperContainerInfo] current monitor keeperContainer:{}", ipList);
dcMeta.getKeeperContainers().forEach(keeperContainerMeta -> {
if(!hostPort2InputFlow.containsKey(keeperContainerMeta.getIp())) {
hostPort2InputFlow.put(keeperContainerMeta.getIp(), new ConcurrentHashMap<>());
}
});
for (String ip : hostPort2InputFlow.keySet()) {
if (!ipList.contains(ip)) {
logger.warn("[reportKeeperContainerInfo] keeperContainer:{} is not exit in console meta", ip);
hostPort2InputFlow.remove(ip);
}
dcMeta.getKeeperContainers().forEach(keeperContainerMeta -> {
if (collectedInfos.containsKey(keeperContainerMeta.getIp())) {
hostPort2InputFlow.put(keeperContainerMeta.getIp(), collectedInfos.get(keeperContainerMeta.getIp()));
} else {
hostPort2InputFlow.put(keeperContainerMeta.getIp(), new ConcurrentHashMap<>());
}
}
});
}
Map<DcClusterShard, Long> dcClusterShardUsedMemory = redisUsedMemoryCollector.getDcClusterShardUsedMemory();
List<KeeperContainerUsedInfoModel> result = new ArrayList<>(hostPort2InputFlow.keySet().size());
Expand Down

0 comments on commit 807df4a

Please sign in to comment.