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 2021/11/17 01:16:25 UTC

[GitHub] [pulsar] merlimat opened a new pull request #12841: PIP-45: Converted BookieRackAffinityMapping to use MetadataStore

merlimat opened a new pull request #12841:
URL: https://github.com/apache/pulsar/pull/12841


   ### Motivation
   
   The BookieRackAffinityMapping is based on reading the (bookie->rack) mapping from a z-node. Therefore we're injecting the ZK client in the RackAffinity plugin. 
   Instead, we are going to inject the instance of `MetadataStore` in the properties, so that we're not depending on the ZK implementation.


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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] codelipenghui commented on a change in pull request #12841: PIP-45: Converted BookieRackAffinityMapping to use MetadataStore

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #12841:
URL: https://github.com/apache/pulsar/pull/12841#discussion_r760139574



##########
File path: pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java
##########
@@ -16,69 +16,67 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pulsar.zookeeper;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
+package org.apache.pulsar.bookie.rackawareness;
 
 import java.net.InetAddress;
-import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-import java.util.concurrent.TimeUnit;
-
+import java.util.concurrent.CompletableFuture;
 import org.apache.bookkeeper.client.ITopologyAwareEnsemblePlacementPolicy;
 import org.apache.bookkeeper.client.RackChangeNotifier;
-import org.apache.bookkeeper.conf.ClientConfiguration;
 import org.apache.bookkeeper.net.AbstractDNSToSwitchMapping;
 import org.apache.bookkeeper.net.BookieId;
 import org.apache.bookkeeper.net.BookieNode;
 import org.apache.bookkeeper.net.BookieSocketAddress;
 import org.apache.bookkeeper.proto.BookieAddressResolver;
-import org.apache.bookkeeper.zookeeper.ZooKeeperClient;
 import org.apache.commons.configuration.Configuration;
 import org.apache.pulsar.common.policies.data.BookieInfo;
 import org.apache.pulsar.common.policies.data.BookiesRackConfiguration;
-import org.apache.pulsar.common.util.ObjectMapperFactory;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
+import org.apache.pulsar.metadata.api.MetadataCache;
+import org.apache.pulsar.metadata.api.MetadataStore;
+import org.apache.pulsar.metadata.api.Notification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.bookkeeper.meta.zk.ZKMetadataDriverBase.getZKServersFromServiceUri;
-
 /**
  * It provides the mapping of bookies to its rack from zookeeper.
  */
-public class ZkBookieRackAffinityMapping extends AbstractDNSToSwitchMapping

Review comment:
       We should keep the old class, otherwise, we will break the user's cluster after upgrading to the new Pulsar version.
   
   This one is used in bookkeeper.conf, `reppDnsResolverClass=org.apache.pulsar.zookeeper.ZkBookieRackAffinityMapping`.




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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] merlimat merged pull request #12841: PIP-45: Converted BookieRackAffinityMapping to use MetadataStore

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #12841:
URL: https://github.com/apache/pulsar/pull/12841


   


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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] merlimat commented on a change in pull request #12841: PIP-45: Converted BookieRackAffinityMapping to use MetadataStore

Posted by GitBox <gi...@apache.org>.
merlimat commented on a change in pull request #12841:
URL: https://github.com/apache/pulsar/pull/12841#discussion_r760333559



##########
File path: pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java
##########
@@ -16,69 +16,67 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pulsar.zookeeper;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
+package org.apache.pulsar.bookie.rackawareness;
 
 import java.net.InetAddress;
-import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-import java.util.concurrent.TimeUnit;
-
+import java.util.concurrent.CompletableFuture;
 import org.apache.bookkeeper.client.ITopologyAwareEnsemblePlacementPolicy;
 import org.apache.bookkeeper.client.RackChangeNotifier;
-import org.apache.bookkeeper.conf.ClientConfiguration;
 import org.apache.bookkeeper.net.AbstractDNSToSwitchMapping;
 import org.apache.bookkeeper.net.BookieId;
 import org.apache.bookkeeper.net.BookieNode;
 import org.apache.bookkeeper.net.BookieSocketAddress;
 import org.apache.bookkeeper.proto.BookieAddressResolver;
-import org.apache.bookkeeper.zookeeper.ZooKeeperClient;
 import org.apache.commons.configuration.Configuration;
 import org.apache.pulsar.common.policies.data.BookieInfo;
 import org.apache.pulsar.common.policies.data.BookiesRackConfiguration;
-import org.apache.pulsar.common.util.ObjectMapperFactory;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
+import org.apache.pulsar.metadata.api.MetadataCache;
+import org.apache.pulsar.metadata.api.MetadataStore;
+import org.apache.pulsar.metadata.api.Notification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.bookkeeper.meta.zk.ZKMetadataDriverBase.getZKServersFromServiceUri;
-
 /**
  * It provides the mapping of bookies to its rack from zookeeper.
  */
-public class ZkBookieRackAffinityMapping extends AbstractDNSToSwitchMapping

Review comment:
       I don't find it in the config files, but yes, it's a good idea to retain the name. I'll add it back as an empty class extending the new one.




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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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