Skip to content

Commit

Permalink
Fix topicPublisher thread may NPE when no topic exists (apache#29306)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangbo authored and HappenLee committed Jan 12, 2024
1 parent 545cdf3 commit d55bdb7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ protected void runAfterCatalogReady() {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public WorkloadGroupPublisher(Env env) {
@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public WorkloadSchedPolicyPublisher(Env env) {
@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);
}

}

0 comments on commit d55bdb7

Please sign in to comment.