btlqql commented on PR #4683:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/4683#issuecomment-5762421267

   Reworked onto `4c697f07`. Blocking item 2 answered with option (b), and the 
"at most once per call" half of option (a) as well.
   
   **The seam.** Resolution now goes through `BrokerHostResolver`, a 
single-method interface (`DEFAULT = InetAddress::getByName`), plus 
`BrokerHostResolver.caching(delegate)` — a memoizing wrapper that remembers 
failures as well as successes, so an unresolvable registered host is not 
retried either. `RocketMQMessageProvider.perQueryHostResolver()` and the 
equivalent in `RocketMQDLQProvider` build one caching resolver per 
query/resend, which is the exact case you named: one `queryByMsgId` evaluates 
the guard twice (`:150` before `viewMessage`, then the decoded-offset 
fallback), and now the second evaluation compares instead of resolving again. 
Both entry points take the resolver as a parameter, so tests inject a fake and 
**count** lookups — the bound is asserted, not described.
   
   **The javadoc** states both requested things: the accepted set widens from 
"the literal registered string" to "whatever the registered host currently 
resolves to", and the expected DNS cost with its bound. It also says plain what 
you flagged — the platform lookup has no wall-clock timeout of its own, since 
`InetAddress` exposes no knob and the JVM/OS resolver decides — which is the 
second reason the seam exists: a deployment wanting a hard bound or a 
cross-request cache supplies its own resolver without touching the guard. 
Failure direction is unchanged: an unresolvable registered host matches 
nothing, so the id stays rejected.
   
   **Nice-to-have:** 
`rejectsAnOffsetIdWhenTheRegisteredHostnameCannotBeResolved` no longer does 
real DNS — the class now uses `FakeBrokerHostResolver` throughout, so no test 
in it touches the network.
   
   **Mutation check** — resolved-address fallback removed (pre-fix exact-string 
behaviour), tests untouched:
   
   ```
   [ERROR] Tests run: 110, Failures: 6, Errors: 0, Skipped: 0
   [ERROR]   
BrokerTopologyGuardsTest.acceptsAnOffsetIdWhoseBrokerIsRegisteredWithAHostnameTest:51
   [ERROR]   
BrokerTopologyGuardsTest.acceptsAnIdWhoseAddressMatchesOneOfSeveralRegisteredEndpointsTest:64
   [ERROR]   
BrokerTopologyGuardsTest.rejectsAnOffsetIdWhenTheRegisteredHostnameCannotBeResolvedTest:116
   [ERROR]   
BrokerTopologyGuardsTest.reusesOneResolutionAcrossRepeatedEvaluationsOfTheSameGuardTest:76
   [ERROR]   
RocketMQMessageProviderTest.queryByMsgIdAcceptsAHostnameRegisteredBrokerAndLooksItUpOnceTest:524
   [ERROR]   
RocketMQDLQProviderTest.resendSelectedMessagesLooksUpAHostnameRegisteredBrokerOnceForAllSelectedIdsTest:454
   ```
   
   Whole suite on a host with MySQL 8 reachable: 3160 tests, 0 failures, 0 
errors (3145 on the untouched head).
   


-- 
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]

Reply via email to