Fix topicPublisher thread may NPE when no topic exists (#29306)

This commit is contained in:
wangbo
2023-12-29 23:04:20 +08:00
committed by GitHub
parent 59fdd5e42b
commit 03ece437f0
3 changed files with 4 additions and 9 deletions

View File

@ -66,9 +66,8 @@ public class TopicPublisherThread extends MasterDaemon {
topicPublisher.getTopicInfo(request);
}
if (request.getTopicMap().size() == 0) {
return;
}
// even request contains no group and schedule policy, we still need to send an empty rpc.
// because it may means workload group/policy is dropped
// step 2: publish topic info to all be
Collection<Backend> nodesToPublish = clusterInfoService.getIdToBackend().values();

View File

@ -35,8 +35,6 @@ public class WorkloadGroupPublisher implements TopicPublisher {
@Override
public void getTopicInfo(TPublishTopicRequest req) {
List<TopicInfo> list = env.getWorkloadGroupMgr().getPublishTopicInfo();
if (list.size() > 0) {
req.putToTopicMap(TTopicInfoType.WORKLOAD_GROUP, list);
}
req.putToTopicMap(TTopicInfoType.WORKLOAD_GROUP, list);
}
}

View File

@ -36,9 +36,7 @@ public class WorkloadSchedPolicyPublisher implements TopicPublisher {
@Override
public void getTopicInfo(TPublishTopicRequest req) {
List<TopicInfo> list = env.getWorkloadSchedPolicyMgr().getPublishTopicInfoList();
if (list.size() > 0) {
req.putToTopicMap(TTopicInfoType.WORKLOAD_SCHED_POLICY, list);
}
req.putToTopicMap(TTopicInfoType.WORKLOAD_SCHED_POLICY, list);
}
}