Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #8025] fix: fix topic route when topic deleted #8027

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

HScarb
Copy link
Contributor

@HScarb HScarb commented Apr 16, 2024

Which Issue(s) This PR Fixes

Fixes #8025

Brief Description

  1. make getTopicRouteInfoFromNameServer return null when the topic not exist and allow the topic not exist
  2. remove the topic from topicRouteTable when topic is null

How Did You Test This Change?

UT

@HScarb HScarb requested a review from lizhimins April 23, 2024 15:49
Copy link
Contributor

@leizhiyuan leizhiyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 42.80%. Comparing base (04dddec) to head (c8e1ef8).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #8027      +/-   ##
=============================================
- Coverage      42.82%   42.80%   -0.02%     
- Complexity     10345    10350       +5     
=============================================
  Files           1270     1270              
  Lines          88677    88678       +1     
  Branches       11398    11398              
=============================================
- Hits           37973    37961      -12     
- Misses         46004    46017      +13     
  Partials        4700     4700              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -2007,6 +2007,7 @@ public TopicRouteData getTopicRouteInfoFromNameServer(final String topic, final
case ResponseCode.TOPIC_NOT_EXIST: {
if (allowTopicNotExist) {
log.warn("get Topic [{}] RouteInfoFromNameServer is not exist value", topic);
return null;
Copy link
Member

@cserwen cserwen May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may cause some npe, maybe need to check, such as

public boolean createTopicOnTopicBrokerIfNotExist(String createTopic, String sampleTopic, int wQueueNum,
int rQueueNum, boolean examineTopic, int retryCheckCount) {
TopicRouteData curTopicRouteData = new TopicRouteData();
try {
curTopicRouteData = this.getTopicRouteDataDirectlyFromNameServer(createTopic);
} catch (Exception e) {
if (!TopicRouteHelper.isTopicNotExistError(e)) {
log.error("get cur topic route {} failed.", createTopic, e);
return false;
}
}
TopicRouteData sampleTopicRouteData = null;
try {
sampleTopicRouteData = this.getTopicRouteDataDirectlyFromNameServer(sampleTopic);
} catch (Exception e) {
log.error("create topic {} failed.", createTopic, e);
return false;
}
if (sampleTopicRouteData == null || sampleTopicRouteData.getBrokerDatas().isEmpty()) {
return false;
}
try {
return this.createTopicOnBroker(createTopic, wQueueNum, rQueueNum, curTopicRouteData.getBrokerDatas(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants