Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
[fix][broker] Allow broker deployment in heterogeneous hw config clus…
Browse files Browse the repository at this point in the history
…ter without restricting nic speed detection (apache#21409)
  • Loading branch information
rdhabalia authored Oct 24, 2023
1 parent 25c662d commit 789d284
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -83,7 +83,6 @@
import org.apache.pulsar.broker.intercept.BrokerInterceptors;
import org.apache.pulsar.broker.loadbalance.LeaderBroker;
import org.apache.pulsar.broker.loadbalance.LeaderElectionService;
import org.apache.pulsar.broker.loadbalance.LinuxInfoUtils;
import org.apache.pulsar.broker.loadbalance.LoadManager;
import org.apache.pulsar.broker.loadbalance.LoadReportUpdaterTask;
import org.apache.pulsar.broker.loadbalance.LoadResourceQuotaUpdaterTask;
@@ -733,14 +732,6 @@ public void start() throws PulsarServerException {
config.getDefaultRetentionTimeInMinutes() * 60));
}

if (config.getLoadBalancerOverrideBrokerNicSpeedGbps().isEmpty()
&& config.isLoadBalancerEnabled()
&& LinuxInfoUtils.isLinux()
&& !LinuxInfoUtils.checkHasNicSpeeds()) {
throw new IllegalStateException("Unable to read VM NIC speed. You must set "
+ "[loadBalancerOverrideBrokerNicSpeedGbps] to override it when load balancer is enabled.");
}

localMetadataSynchronizer = StringUtils.isNotBlank(config.getMetadataSyncEventTopic())
? new PulsarMetadataEventSynchronizer(this, config.getMetadataSyncEventTopic())
: null;
Original file line number Diff line number Diff line change
@@ -256,6 +256,14 @@ public void testCheckOwnershipAsync() throws Exception {
TopicName topicName = TopicName.get(defaultTestNamespace + "/test-check-ownership");
NamespaceBundle bundle = getBundleAsync(pulsar1, topicName).get();
// 1. The bundle is never assigned.
retryStrategically((test) -> {
try {
return !primaryLoadManager.checkOwnershipAsync(Optional.empty(), bundle).get()
&& !secondaryLoadManager.checkOwnershipAsync(Optional.empty(), bundle).get();
} catch (Exception e) {
return false;
}
}, 5, 200);
assertFalse(primaryLoadManager.checkOwnershipAsync(Optional.empty(), bundle).get());
assertFalse(secondaryLoadManager.checkOwnershipAsync(Optional.empty(), bundle).get());

Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
package org.apache.pulsar.tests.integration.loadbalance;

import static org.apache.pulsar.tests.integration.containers.PulsarContainer.BROKER_HTTP_PORT;
import static org.apache.pulsar.tests.integration.suites.PulsarTestSuite.retryStrategically;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -308,7 +309,7 @@ public void testAntiaffinityPolicy() throws PulsarAdminException {
}

@Test(timeOut = 40 * 1000)
public void testIsolationPolicy() throws PulsarAdminException {
public void testIsolationPolicy() throws Exception {
final String namespaceIsolationPolicyName = "my-isolation-policy";
final String isolationEnabledNameSpace = DEFAULT_TENANT + "/my-isolation-policy" + nsSuffix;
Map<String, String> parameters1 = new HashMap<>();
@@ -346,6 +347,8 @@ public void testIsolationPolicy() throws PulsarAdminException {

broker = admin.lookups().lookupTopic(topic);

final String brokerName = broker;
retryStrategically((test) -> extractBrokerIndex(brokerName) == 1, 100, 200);
assertEquals(extractBrokerIndex(broker), 1);

for (BrokerContainer container : pulsarCluster.getBrokers()) {

0 comments on commit 789d284

Please sign in to comment.