Repository navigation
Conversation
BrokerTopologyGuards compared the IP embedded in an offset msgId directly against the broker addresses registered with the NameServer. When a broker registers by hostname instead of an IP, the guard misclassified the embedded address as off-cluster and the message-id query returned no rows even though the message exists. Also register the resolved IP form of each known broker endpoint so the embedded-IP comparison matches hostname-registered brokers. Fixes apache#4181 Signed-off-by: jokerzsd <2701819133@qq.com>
SummaryAutomated review scan for PR #4205: fix(studio): resolve hostname brokers when guarding message id queries Change Stats: +102 -1 across 2 files Review NotesThis PR has been flagged for review. Key areas to verify:
Existing ReviewsAutomated scan by github-manager • Bot: @RockteMQ-AI |
Code Review: PR #4205Summary: Fix message-id query returning no rows when broker registers by hostname instead of IP address. The solution adds DNS resolution to populate both hostname:port and ip:port forms in the known broker endpoints set. ✅ Strengths
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM. Changes look good.
Automated review by github-manager-bot
|
Closing: this has the same design problems we raised on #4182, which is back with its author. Broker hostnames are resolved inside the synchronous request thread with no timeout and no cache, DNS becomes the trust anchor for a topology check, and the existing Three further issues: We think the whole area needs a topology snapshot layer with its own timeout and cache rather than another call-site guard. |
Summary
Fix message-id query returning no rows when the broker registers by hostname instead of an IP address.
Problem
BrokerTopologyGuardscompared the IP embedded in an offsetmsgId(fromdecodedBrokerAddr) directly against the broker addresses registered with the NameServer (knownBrokerEndpoints). When a broker registered by hostname (e.g.repro-hostname-broker:10911), the guard misclassified the embedded IP as off-cluster and rejected the lookup, so the message-id query returned zero rows even though the message existed and the official SDK could read it.Fix
Also register the resolved
ip:portform of each known broker endpoint inknownBrokerEndpoints, so the embedded-IP comparison matches hostname-registered brokers. Plain-IP brokers are unchanged.Test plan
Added
BrokerTopologyGuardsTest(JUnit 5 + Mockito) covering:Verified with
mvn test -Dtest=BrokerTopologyGuardsTest(Java 21,Tests run: 2, Failures: 0).Fixes #4181