diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java index 0e2d72d2b3a99..677c1e8633556 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java @@ -27,23 +27,7 @@ public class ConsistentHashingTopicBundleAssigner implements TopicBundleAssignme private PulsarService pulsar; @Override public NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespaceBundles) { -<<<<<<< Updated upstream -<<<<<<< Updated upstream - NamespaceBundle bundle = namespaceBundles.getBundle(getHashCode(topicName.toString())); -======= -<<<<<<< HEAD -<<<<<<< HEAD NamespaceBundle bundle = namespaceBundles.getBundle(calculateBundleHashCode(topicName)); -======= - NamespaceBundle bundle = namespaceBundles.getBundle(getHashCode(topicName.toString())); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= - NamespaceBundle bundle = namespaceBundles.getBundle(getHashCode(topicName.toString())); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf ->>>>>>> Stashed changes -======= - NamespaceBundle bundle = namespaceBundles.getBundle(calculateBundleHashCode(topicName)); ->>>>>>> Stashed changes if (topicName.getDomain().equals(TopicDomain.non_persistent)) { bundle.setHasNonPersistentTopic(true); } @@ -51,47 +35,8 @@ public NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespac } @Override -<<<<<<< Updated upstream -<<<<<<< Updated upstream -======= -<<<<<<< HEAD -<<<<<<< HEAD - public long calculateBundleHashCode(TopicName topicName) { - return getBundleHashFunc().hashString(topicName.toString(), StandardCharsets.UTF_8).padToLong(); -======= -======= ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf ->>>>>>> Stashed changes - public long getHashCode(String name) { - return pulsar.getNamespaceService().getNamespaceBundleFactory().getHashFunc() - .hashString(name, StandardCharsets.UTF_8) - .padToLong(); -<<<<<<< Updated upstream - } - - @Override - public void init(PulsarService pulsarService) { - this.pulsar = pulsarService; -======= -<<<<<<< HEAD -======= ->>>>>>> Stashed changes - } - - @Override - public void init(PulsarService pulsarService) { - this.pulsar = pulsarService; ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf - } - - @Override - public void init(PulsarService pulsarService) { - this.pulsar = pulsarService; ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= public long calculateBundleHashCode(TopicName topicName) { return getBundleHashFunc().hashString(topicName.toString(), StandardCharsets.UTF_8).padToLong(); ->>>>>>> Stashed changes } @Override diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/NamespaceBundleFactory.java b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/NamespaceBundleFactory.java index 91515ba569ef0..c4f0ada491236 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/NamespaceBundleFactory.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/NamespaceBundleFactory.java @@ -293,23 +293,7 @@ public CompletableFuture getFullBundleAsync(NamespaceName fqnn) } public long getLongHashCode(String name) { -<<<<<<< Updated upstream -<<<<<<< Updated upstream - return this.topicBundleAssignmentStrategy.getHashCode(name); -======= -<<<<<<< HEAD -<<<<<<< HEAD return this.topicBundleAssignmentStrategy.calculateBundleHashCode(TopicName.get(name)); -======= - return this.topicBundleAssignmentStrategy.getHashCode(name); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= - return this.topicBundleAssignmentStrategy.getHashCode(name); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf ->>>>>>> Stashed changes -======= - return this.topicBundleAssignmentStrategy.calculateBundleHashCode(TopicName.get(name)); ->>>>>>> Stashed changes } public NamespaceBundles getBundles(NamespaceName nsname, BundlesData bundleData) { diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategy.java b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategy.java index 4c3821e704d19..e5e0e5bd857a8 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategy.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategy.java @@ -25,27 +25,9 @@ public interface TopicBundleAssignmentStrategy { NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespaceBundles); -<<<<<<< Updated upstream -<<<<<<< Updated upstream - long getHashCode(String name); -======= -<<<<<<< HEAD -<<<<<<< HEAD default long calculateBundleHashCode(TopicName topicName) { return Hashing.crc32().hashString(topicName.toString(), StandardCharsets.UTF_8).padToLong(); } -======= - long getHashCode(String name); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= - long getHashCode(String name); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf ->>>>>>> Stashed changes -======= - default long calculateBundleHashCode(TopicName topicName) { - return Hashing.crc32().hashString(topicName.toString(), StandardCharsets.UTF_8).padToLong(); - } ->>>>>>> Stashed changes void init(PulsarService pulsarService); } diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategyTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategyTest.java index 83b8057621f5f..d5719d12985be 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategyTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/common/naming/TopicBundleAssignmentStrategyTest.java @@ -87,19 +87,7 @@ public NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespac } @Override -<<<<<<< Updated upstream -<<<<<<< HEAD -<<<<<<< HEAD public long calculateBundleHashCode(TopicName topicName) { -======= - public long getHashCode(String name) { ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= - public long getHashCode(String name) { ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= - public long calculateBundleHashCode(TopicName topicName) { ->>>>>>> Stashed changes return 0; } @@ -145,19 +133,7 @@ public static class RoundRobinBundleAssigner implements TopicBundleAssignmentStr @Override public NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespaceBundles) { -<<<<<<< Updated upstream -<<<<<<< HEAD -<<<<<<< HEAD - NamespaceBundle bundle = namespaceBundles.getBundle(calculateBundleHashCode(topicName)); -======= - NamespaceBundle bundle = namespaceBundles.getBundle(getHashCode(topicName.toString())); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= - NamespaceBundle bundle = namespaceBundles.getBundle(getHashCode(topicName.toString())); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= NamespaceBundle bundle = namespaceBundles.getBundle(calculateBundleHashCode(topicName)); ->>>>>>> Stashed changes if (topicName.getDomain().equals(TopicDomain.non_persistent)) { bundle.setHasNonPersistentTopic(true); } @@ -165,25 +141,8 @@ public NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespac } @Override -<<<<<<< Updated upstream -<<<<<<< HEAD -<<<<<<< HEAD - public long calculateBundleHashCode(TopicName topicName) { - // use topic name without partition id to decide the first hash value -======= - public long getHashCode(String name) { - // use topic name without partition id to decide the first hash value - TopicName topicName = TopicName.get(name); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= - public long getHashCode(String name) { - // use topic name without partition id to decide the first hash value - TopicName topicName = TopicName.get(name); ->>>>>>> 43e069997e962052bc3376f3cf91e8191f9340bf -======= public long calculateBundleHashCode(TopicName topicName) { // use topic name without partition id to decide the first hash value ->>>>>>> Stashed changes long currentPartitionTopicHash = pulsar.getNamespaceService().getNamespaceBundleFactory().getHashFunc() .hashString(topicName.getPartitionedTopicName(), Charsets.UTF_8).padToLong();