You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/12/15 10:11:14 UTC

[GitHub] [pulsar] zymap commented on a change in pull request #8961: (WIP) Fixes the recovery not respect to the isolation group settings

zymap commented on a change in pull request #8961:
URL: https://github.com/apache/pulsar/pull/8961#discussion_r543212744



##########
File path: pulsar-zookeeper-utils/src/main/java/org/apache/pulsar/zookeeper/ZkIsolatedBookieEnsemblePlacementPolicy.java
##########
@@ -74,23 +78,26 @@ public RackawareEnsemblePlacementPolicyImpl initialize(ClientConfiguration conf,
         if (conf.getProperty(ISOLATION_BOOKIE_GROUPS) != null) {
             String isolationGroupsString = castToString(conf.getProperty(ISOLATION_BOOKIE_GROUPS));
             if (!isolationGroupsString.isEmpty()) {
-                for (String isolationGroup : isolationGroupsString.split(",")) {
-                    primaryIsolationGroups.add(isolationGroup);
-                }
+                fillIsolationGroup(isolationGroupsString, "");
                 bookieMappingCache = getAndSetZkCache(conf);
             }
         }
         if (conf.getProperty(SECONDARY_ISOLATION_BOOKIE_GROUPS) != null) {
             String secondaryIsolationGroupsString = castToString(conf.getProperty(SECONDARY_ISOLATION_BOOKIE_GROUPS));
-            if (!secondaryIsolationGroupsString.isEmpty()) {
-                for (String isolationGroup : secondaryIsolationGroupsString.split(",")) {
-                    secondaryIsolationGroups.add(isolationGroup);
-                }
-            }
+            fillIsolationGroup("", secondaryIsolationGroupsString);
         }
         return super.initialize(conf, optionalDnsResolver, timer, featureProvider, statsLogger, bookieAddressResolver);
     }
 
+    private void fillIsolationGroup(String isolationBookieGroups, String secondaryIsolationBookieGroups) {
+        if (!isolationBookieGroups.isEmpty()) {
+            primaryIsolationGroups.addAll(Arrays.asList(isolationBookieGroups.split(",")));

Review comment:
       okay. I will fix it. 
   I wonder if it called from auto-recovery, the primaryIsolationGroups should be empty, right? Because the auto-recovery hasn't filled the list.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org