Fix topic list filter condition

This commit is contained in:
17hao
2021-02-04 16:30:23 +08:00
parent 9491418f3b
commit c7919210a2

View File

@@ -276,13 +276,8 @@ public class TopicManagerServiceImpl implements TopicManagerService {
} }
Map<Long, Map<String, TopicDO>> topicMap = new HashMap<>(appList.size()); Map<Long, Map<String, TopicDO>> topicMap = new HashMap<>(appList.size());
for (TopicDO topicDO: topicList) { for (TopicDO topicDO: topicList) {
String topicName = topicDO.getTopicName();
if (topicName.equals(KafkaConstant.COORDINATOR_TOPIC_NAME) ||
topicName.equals(KafkaConstant.TRANSACTION_TOPIC_NAME)) {
continue;
}
Map<String, TopicDO> subTopicMap = topicMap.getOrDefault(topicDO.getClusterId(), new HashMap<>()); Map<String, TopicDO> subTopicMap = topicMap.getOrDefault(topicDO.getClusterId(), new HashMap<>());
subTopicMap.put(topicName, topicDO); subTopicMap.put(topicDO.getTopicName(), topicDO);
topicMap.put(topicDO.getClusterId(), subTopicMap); topicMap.put(topicDO.getClusterId(), subTopicMap);
} }
@@ -299,14 +294,15 @@ public class TopicManagerServiceImpl implements TopicManagerService {
Map<String, TopicDO> topicMap) { Map<String, TopicDO> topicMap) {
List<TopicDTO> dtoList = new ArrayList<>(); List<TopicDTO> dtoList = new ArrayList<>();
for (String topicName: PhysicalClusterMetadataManager.getTopicNameList(clusterDO.getId())) { for (String topicName: PhysicalClusterMetadataManager.getTopicNameList(clusterDO.getId())) {
if (topicName.equals(KafkaConstant.COORDINATOR_TOPIC_NAME) || topicName.equals(KafkaConstant.TRANSACTION_TOPIC_NAME)) {
continue;
}
LogicalClusterDO logicalClusterDO = logicalClusterMetadataManager.getTopicLogicalCluster( LogicalClusterDO logicalClusterDO = logicalClusterMetadataManager.getTopicLogicalCluster(
clusterDO.getId(), clusterDO.getId(),
topicName topicName
); );
if (ValidateUtils.isNull(logicalClusterDO)) {
TopicDO topicDO = topicMap.get(topicName);
if (ValidateUtils.isNull(topicDO) || ValidateUtils.isNull(logicalClusterDO)) {
continue; continue;
} }
@@ -317,6 +313,11 @@ public class TopicManagerServiceImpl implements TopicManagerService {
dto.setLogicalClusterName(logicalClusterDO.getName()); dto.setLogicalClusterName(logicalClusterDO.getName());
dto.setTopicName(topicName); dto.setTopicName(topicName);
dto.setNeedAuth(Boolean.TRUE); dto.setNeedAuth(Boolean.TRUE);
TopicDO topicDO = topicMap.get(topicName);
if (ValidateUtils.isNull(topicDO)) {
continue;
}
dto.setDescription(topicDO.getDescription()); dto.setDescription(topicDO.getDescription());
dto.setAppId(topicDO.getAppId()); dto.setAppId(topicDO.getAppId());