This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new c6c722ac5 fix(lite): probe every master for the LiteTopic capability
(#4568)
c6c722ac5 is described below
commit c6c722ac53ea780c0ca52f69b52dc6a59a5eb4d3
Author: 烤化の初雪 <[email protected]>
AuthorDate: Sat Sep 26 18:45:43 2026 +0800
fix(lite): probe every master for the LiteTopic capability (#4568)
The capability probe only asked masters.get(0), so on a mixed-version
cluster (or while that single master restarts) the whole LiteTopic page
degraded to unsupported even though its peers answer the lite admin
RPC. Probe every master and report supported when any of them answers,
matching the per-master degradation the read paths already apply.
Fixes #4567.
---
.../provider/apache/RocketMQLiteTopicProvider.java | 18 ++++++++++++++++--
.../provider/apache/RocketMQLiteTopicProviderTest.java | 10 ++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProvider.java
b/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProvider.java
index 73042a056..0cbb694a3 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProvider.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProvider.java
@@ -114,8 +114,22 @@ public class RocketMQLiteTopicProvider implements
LiteTopicProvider {
}
try {
return
Boolean.TRUE.equals(adminFactory.execute(properties.getNamesrvAddr(), null,
admin -> {
- List<String> masters = masterAddresses(admin);
- return !masters.isEmpty() &&
admin.getBrokerLiteInfo(masters.get(0)) != null;
+ // Probe every master and report supported when any of them
answers the lite
+ // admin RPC: the iteration order of examineBrokerClusterInfo
is arbitrary,
+ // so probing only the first master would disable the whole
console on a
+ // mixed-version cluster (or while that one master restarts)
even though
+ // the feature stays reachable through its peers.
+ for (String master : masterAddresses(admin)) {
+ try {
+ if (admin.getBrokerLiteInfo(master) != null) {
+ return true;
+ }
+ } catch (Exception probeFailure) {
+ log.debug("LiteTopic capability probe failed on {}:
{}",
+ master, probeFailure.getMessage());
+ }
+ }
+ return false;
}));
} catch (Exception probeFailure) {
// An older broker answers the lite RPC with an unsupported-code
error; that is the
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProviderTest.java
b/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProviderTest.java
index 009edba67..d392ee6ae 100644
---
a/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProviderTest.java
+++
b/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQLiteTopicProviderTest.java
@@ -124,6 +124,16 @@ class RocketMQLiteTopicProviderTest {
assertThat(provider.isSupported()).isTrue();
}
+ @Test
+ void isSupportedIsTrueWhenAnyOtherMasterAnswersTheLiteProbe() throws
Exception {
+ String legacyMaster = "127.0.0.1:10912";
+
when(admin.examineBrokerClusterInfo()).thenReturn(cluster(legacyMaster,
BROKER_A));
+ when(admin.getBrokerLiteInfo(legacyMaster)).thenThrow(new
IllegalStateException("unsupported"));
+ when(admin.getBrokerLiteInfo(BROKER_A)).thenReturn(brokerLiteInfo(2,
40, 1));
+
+ assertThat(provider.isSupported()).isTrue();
+ }
+
@Test
void listLiteTopicsSkipsAMasterWhoseLiteInfoFailsInsteadOfFailingThePage()
throws Exception {
String failingMaster = "127.0.0.1:10912";