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
base: develop
Are you sure you want to change the base?
Conversation
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
@@ -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; |
There was a problem hiding this comment.
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
rocketmq/proxy/src/main/java/org/apache/rocketmq/proxy/service/admin/DefaultAdminService.java
Lines 60 to 85 in ad02756
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(), |
Which Issue(s) This PR Fixes
Fixes #8025
Brief Description
getTopicRouteInfoFromNameServer
return null when the topic not exist and allow the topic not existtopicRouteTable
when topic is nullHow Did You Test This Change?
UT