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 1a9d01ce fix(cluster): isolate configuration snapshots (#1531)
1a9d01ce is described below

commit 1a9d01ce68a53f5ef1b365f6b4c4204b7a38e67b
Author: aias00 <[email protected]>
AuthorDate: Tue Aug 11 20:21:48 2026 +0800

    fix(cluster): isolate configuration snapshots (#1531)
    
    Signed-off-by: liuhy <[email protected]>
---
 .../studio/cluster/broker/ClusterRepositoryImpl.java | 20 +++++++++++++++++++-
 .../cluster/broker/ClusterRepositoryImplTest.java    |  3 +++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImpl.java
 
b/server/src/main/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImpl.java
index ea33574e..a585f002 100644
--- 
a/server/src/main/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImpl.java
+++ 
b/server/src/main/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImpl.java
@@ -94,7 +94,7 @@ public class ClusterRepositoryImpl implements 
ClusterRepository {
                 .brokers(cluster.getBrokers() == null ? null : new 
ArrayList<>(cluster.getBrokers()))
                 .proxies(cluster.getProxies() == null ? null : new 
ArrayList<>(cluster.getProxies()))
                 .nameServers(cluster.getNameServers() == null ? null : new 
ArrayList<>(cluster.getNameServers()))
-                .config(cluster.getConfig())
+                .config(copyConfig(cluster.getConfig()))
                 .topicCount(cluster.getTopicCount())
                 .groupCount(cluster.getGroupCount())
                 .tpsHistory(cluster.getTpsHistory() == null ? null : new 
ArrayList<>(cluster.getTpsHistory()))
@@ -105,6 +105,24 @@ public class ClusterRepositoryImpl implements 
ClusterRepository {
         return copy;
     }
 
+    private ClusterConfigVO copyConfig(ClusterConfigVO config) {
+        if (config == null) {
+            return null;
+        }
+        return ClusterConfigVO.builder()
+                .writeQueueNums(config.getWriteQueueNums())
+                .readQueueNums(config.getReadQueueNums())
+                .maxMessageSize(config.getMaxMessageSize())
+                .msgTraceTopicName(config.getMsgTraceTopicName())
+                .autoCreateTopicEnable(config.isAutoCreateTopicEnable())
+                
.autoCreateSubscriptionGroup(config.isAutoCreateSubscriptionGroup())
+                .deleteWhen(config.getDeleteWhen())
+                .fileReservedTime(config.getFileReservedTime())
+                .flushDiskType(config.getFlushDiskType())
+                .brokerPermission(config.getBrokerPermission())
+                .build();
+    }
+
     private void initStubData() {
         ClusterConfigVO config = ClusterConfigVO.builder()
                 .writeQueueNums(16)
diff --git 
a/server/src/test/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImplTest.java
 
b/server/src/test/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImplTest.java
index 8077addb..a0cb555b 100644
--- 
a/server/src/test/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImplTest.java
+++ 
b/server/src/test/java/org/apache/rocketmq/studio/cluster/broker/ClusterRepositoryImplTest.java
@@ -47,11 +47,14 @@ class ClusterRepositoryImplTest {
 
         ClusterVO first = repository.findById("cluster-001").orElseThrow();
         first.setName("mutated");
+        first.getConfig().setFileReservedTime(1);
 
         ClusterVO second = repository.findById("cluster-001").orElseThrow();
 
         // Mutating the returned copy must not affect the cached cluster.
         assertThat(second.getName()).isEqualTo("rmq-cluster-prod");
         assertThat(first.getBrokers()).isNotSameAs(second.getBrokers());
+        assertThat(second.getConfig()).isNotSameAs(first.getConfig());
+        assertThat(second.getConfig().getFileReservedTime()).isEqualTo(72);
     }
 }

Reply via email to