Fix topicPublisher thread may NPE when no topic exists (#29306)
This commit is contained in:
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user