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



##########
File path: 
pulsar-zookeeper-utils/src/main/java/org/apache/pulsar/zookeeper/ZkIsolatedBookieEnsemblePlacementPolicy.java
##########
@@ -156,6 +171,38 @@ private ZooKeeperCache getAndSetZkCache(Configuration 
conf) {
                 bookieToReplace, excludeBookies);
     }
 
+    private Optional<EnsemblePlacementPolicyConfig> 
getEnsemblePlacementPolicyConfig(
+        Map<String, byte[]> customMetadata) {
+
+        byte[] ensemblePlacementPolicyConfigData = customMetadata.get(
+            EnsemblePlacementPolicyConfig.ENSEMBLE_PLACEMENT_POLICY_CONFIG);
+        if (ensemblePlacementPolicyConfigData != null) {
+            try {
+                return 
Optional.ofNullable(EnsemblePlacementPolicyConfig.decode(ensemblePlacementPolicyConfigData));
+            } catch (JsonUtil.ParseJsonException e) {
+                LOG.error("Failed to parse the ensemble placement policy 
config from the custom metadata", e);
+                return Optional.empty();
+            }
+        }
+        return Optional.empty();
+    }
+
+    private void fillIsolationGroupWithEnsemblePlacementPolicyConfig(
+        EnsemblePlacementPolicyConfig ensemblePlacementPolicyConfig) {
+
+        String className = 
ZkIsolatedBookieEnsemblePlacementPolicy.class.getName();
+        if 
(ensemblePlacementPolicyConfig.getPolicyClass().getName().equals(className)) {
+            Map<String, Object> properties = 
ensemblePlacementPolicyConfig.getProperties();
+            // Because of we may have different ensemblePolicyConfig from 
different ledgers, so clear
+            // the isolation groups before refilling it.
+            primaryIsolationGroups.clear();

Review comment:
       Yes. I think this is one of the questions. 




----------------------------------------------------------------
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:
[email protected]


Reply via email to