This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 7e1786732c [ISSUE #7626] Topic perm was mistakenly changed to 4 in 
dledger mode (#7661)
7e1786732c is described below

commit 7e1786732cfc1a4e02a17535bed9af2115c18822
Author: littleboy <2283985...@qq.com>
AuthorDate: Fri Dec 15 17:49:47 2023 +0800

    [ISSUE #7626] Topic perm was mistakenly changed to 4 in dledger mode (#7661)
    
    Signed-off-by: littleboy <2283985...@qq.com>
---
 .../java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java
 
b/namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java
index f7a95f0a6d..ce311d392a 100644
--- 
a/namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java
+++ 
b/namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java
@@ -301,6 +301,7 @@ public class RouteInfoManager {
             registerFirst = registerFirst || (StringUtils.isEmpty(oldAddr));
 
             boolean isMaster = MixAll.MASTER_ID == brokerId;
+
             boolean isPrimeSlave = !isOldVersionBroker && !isMaster
                 && brokerId == Collections.min(brokerAddrsMap.keySet());
 
@@ -339,7 +340,8 @@ public class RouteInfoManager {
                             topicConfigWrapper.getDataVersion(), brokerName,
                             entry.getValue().getTopicName())) {
                             final TopicConfig topicConfig = entry.getValue();
-                            if (isPrimeSlave) {
+                            // In Slave Acting Master mode, Namesrv will 
regard the surviving Slave with the smallest brokerId as the "agent" Master, 
and modify the brokerPermission to read-only.
+                            if (isPrimeSlave && 
brokerData.isEnableActingMaster()) {
                                 // Wipe write perm for prime slave
                                 topicConfig.setPerm(topicConfig.getPerm() & 
(~PermName.PERM_WRITE));
                             }

Reply via email to