[Feature]HA-镜像Topic管理(#899)

1、底层Kafka需要是滴滴版本的Kafka;
2、新增镜像Topic的增删改查;
3、新增镜像Topic的指标查看;
This commit is contained in:
zengqiao
2023-02-09 15:19:28 +08:00
committed by EricZeng
parent efdf624c67
commit 861faa5df5
25 changed files with 725 additions and 3 deletions

View File

@@ -29,6 +29,9 @@ public class DataBaseDataLocalCache {
@Value(value = "${cache.metadata.health-check-result-size:10000}")
private Long healthCheckResultCacheSize;
@Value(value = "${cache.metadata.ha-topic-size:10000}")
private Long haTopicCacheSize;
private static Cache<Long, Map<String, TopicMetrics>> topicLatestMetricsCache;
private static Cache<Long, ClusterMetrics> clusterLatestMetricsCache;
@@ -36,6 +39,7 @@ public class DataBaseDataLocalCache {
private static Cache<Long, Map<String, List<Partition>>> partitionsCache;
private static Cache<Long, Map<String, List<HealthCheckResultPO>>> healthCheckResultCache;
private static Cache<String, Boolean> haTopicCache;
@PostConstruct
private void init() {
@@ -58,6 +62,11 @@ public class DataBaseDataLocalCache {
.expireAfterWrite(90, TimeUnit.SECONDS)
.maximumSize(healthCheckResultCacheSize)
.build();
haTopicCache = Caffeine.newBuilder()
.expireAfterWrite(90, TimeUnit.SECONDS)
.maximumSize(haTopicCacheSize)
.build();
}
public static Map<String, TopicMetrics> getTopicMetrics(Long clusterPhyId) {
@@ -100,6 +109,16 @@ public class DataBaseDataLocalCache {
return clusterId * HealthCheckDimensionEnum.MAX_VAL.getDimension() + dimensionCode;
}
public static void putHaTopic(Long clusterPhyId, String topicName) {
String key = clusterPhyId + "@" + topicName;
haTopicCache.put(key, true);
}
public static boolean isHaTopic(Long clusterPhyId, String topicName) {
String key = clusterPhyId + "@" + topicName;
return haTopicCache.getIfPresent(key) != null;
}
/**************************************************** private method ****************************************************/
private DataBaseDataLocalCache() {

View File

@@ -0,0 +1,9 @@
package com.xiaojukeji.know.streaming.km.persistence.mysql.ha;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaojukeji.know.streaming.km.common.bean.po.ha.HaActiveStandbyRelationPO;
import org.springframework.stereotype.Repository;
@Repository
public interface HaActiveStandbyRelationDAO extends BaseMapper<HaActiveStandbyRelationPO> {
}