Skip to content

Commit b903aab

Browse files
passerbyzedyifuzhou
andauthored
修复checker检测keeperContainer时的一个bug (ctripcorp#768)
* 修复checker检测keeperContainer时的一个bug * 修复checker校验空keepercontainer时未考虑dc问题 --------- Co-authored-by: yifuzhou <[email protected]>
1 parent 807df4a commit b903aab

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/KeeperContainerInfoReporter.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,15 @@ public void reportKeeperContainerInfo() {
110110
Map<String, Map<DcClusterShardActive, Long>> collectedInfos = keeperFlowCollector.getHostPort2InputFlow();
111111
Map<String, Map<DcClusterShardActive, Long>> hostPort2InputFlow = new HashMap<>();
112112
for (DcMeta dcMeta : metaCache.getXpipeMeta().getDcs().values()) {
113-
dcMeta.getKeeperContainers().forEach(keeperContainerMeta -> {
114-
if (collectedInfos.containsKey(keeperContainerMeta.getIp())) {
115-
hostPort2InputFlow.put(keeperContainerMeta.getIp(), collectedInfos.get(keeperContainerMeta.getIp()));
116-
} else {
117-
hostPort2InputFlow.put(keeperContainerMeta.getIp(), new ConcurrentHashMap<>());
118-
}
119-
});
113+
if (CURRENT_IDC.equalsIgnoreCase(dcMeta.getId())) {
114+
dcMeta.getKeeperContainers().forEach(keeperContainerMeta -> {
115+
if (collectedInfos.containsKey(keeperContainerMeta.getIp())) {
116+
hostPort2InputFlow.put(keeperContainerMeta.getIp(), collectedInfos.get(keeperContainerMeta.getIp()));
117+
} else {
118+
hostPort2InputFlow.put(keeperContainerMeta.getIp(), new ConcurrentHashMap<>());
119+
}
120+
});
121+
}
120122
}
121123
Map<DcClusterShard, Long> dcClusterShardUsedMemory = redisUsedMemoryCollector.getDcClusterShardUsedMemory();
122124
List<KeeperContainerUsedInfoModel> result = new ArrayList<>(hostPort2InputFlow.keySet().size());

0 commit comments

Comments
 (0)