unbridled-41 opened a new pull request, #3346:
URL: https://github.com/apache/rocketmq-dashboard/pull/3346
### Problem / Evidence
A topic that exists in the Studio metadata database but has no broker route
(partially failed create, replaced cluster, DB import) makes two flows fail
instead of reporting the documented empty state:
- **Topic detail modal** — `GET /topics/{name}/routes` and `GET
/topics/{name}/consumers` both return 502, so `openDetail`
(web/src/pages/instance/topic.tsx:511) shows "Topic 详情加载失败,请稍后重试" instead of
the modal.
- **Sync DB topics to broker** — `openSyncModal` (topic.tsx:576) catches the
502 per topic as `routes: null` and filters it out, so `syncMissing` (populated
from `routes.length === 0`) never contains the missing-route topics the feature
exists to find; the user only sees "部分 Topic 路由校验失败".
Backend trigger: `examineTopicRouteInfo`/`queryTopicConsumeByWho` throw
`MQClientException` `CODE: 17` (`TOPIC_NOT_EXIST`, "Not found topic route info
in name server for topic: X") which both methods' catch-alls turn into
`BusinessException(502)` — the red tests failed with exactly `Failed to get
routes for topic TopicA: CODE: 17 DESC: Not found topic route info in name
server for topic: TopicA`.
### Root cause / Fix
`RocketMQMetadataProvider` has no benign-outcome classification for the
"topic not on the broker yet" state, unlike its siblings
(`RocketMQClientProvider.isTopicNotExist` → `List.of()` for producer
connections, merged in #1043; `isGroupNotOnline` → empty for
progress/subscriptions in this same class).
Fix: add `isTopicRouteAbsent(MQClientException)` (response code
`TOPIC_NOT_EXIST` or the "Not found topic route info" message) and return an
empty route list / empty consumer page from the two affected catch blocks.
Every other admin failure still surfaces as 502 — the existing
`getTopicRoutesSurfacesAdminFailure` and
`getTopicConsumersSurfacesAdminFailure` tests pass unchanged, which honors the
concern raised in #1163 (real failures must not be disguised as empty data).
### Priority & scoring
- Impact 30/40 — breaks the topic detail modal and defeats the whole
sync-DB-topics feature for route-less records.
- Scope 12/20 — topic page detail/sync/rebuild flows, two endpoints, one
provider.
- Reproducibility 20/20 — deterministic once a metadata record lacks a
broker route.
- Maintenance value 14/20 — documented contract in the class javadoc ("a
record without a broker route surfaces as an empty route list instead of being
hidden") plus an in-repo precedent to follow.
- **PRIORITY = 76, FIX_CONFIDENCE = 90** (≥70/≥80 per the contribution bar).
### Tests
- New `RocketMQMetadataProviderTest` cases:
`getTopicRoutesShouldReturnEmptyListWhenTopicHasNoBrokerRoute` and
`getTopicConsumersShouldReturnEmptyPageWhenTopicHasNoBrokerRoute`. Both failed
before the fix (BusinessException 502 with `CODE: 17`) and pass after.
- `mvn -B -ntp test
-Dtest='RocketMQMetadataProviderTest,MetadataServiceTest,TopicControllerTest'`
→ 37/37, 36/36, 16/16 passing.
- Full `mvn -B -ntp test` on this branch: 2037 tests (pristine baseline 2035
+ 2 new); the only 3 failures (`AuthCorsIntegrationTest` ×2,
`AliyunInstanceProviderTest.getGroupProgressShouldMapLagRowsTest`) are
identical to the recorded pristine baseline. Zero new failures.
### Risk
Low. The new branch only classifies the definitive TOPIC_NOT_EXIST answer
from the name server; transport failures, broker errors and timeouts keep the
existing 502 behavior. The related open PR #3102 (name trim/blank guard in
`getTopicRoutes`) targets a different defect in the same method; the hunks do
not overlap.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]