You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/01/30 16:52:18 UTC
[pulsar] branch master updated: [broker] Support
networkTopologyScriptFileName for ScriptBasedMapping (#9363)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 8a8e285 [broker] Support networkTopologyScriptFileName for ScriptBasedMapping (#9363)
8a8e285 is described below
commit 8a8e2852c5c7d5c5af48911699a9762a48659886
Author: hrsakai <hs...@yahoo-corp.jp>
AuthorDate: Sun Jan 31 01:51:45 2021 +0900
[broker] Support networkTopologyScriptFileName for ScriptBasedMapping (#9363)
### Motivation
* We want to use `org.apache.bookkeeper.net.ScriptBasedMapping` for `reppDnsResolverClass`, but it require `networkTopologyScriptFileName`.
### Modifications
* Support `networkTopologyScriptFileName` in broker conf.
---
.../org/apache/pulsar/broker/BookKeeperClientFactoryImpl.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/BookKeeperClientFactoryImpl.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/BookKeeperClientFactoryImpl.java
index be05270..adec96d 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/BookKeeperClientFactoryImpl.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/BookKeeperClientFactoryImpl.java
@@ -23,6 +23,7 @@ import static org.apache.bookkeeper.client.RegionAwareEnsemblePlacementPolicy.RE
import static org.apache.bookkeeper.client.RegionAwareEnsemblePlacementPolicy.REPP_ENABLE_VALIDATION;
import static org.apache.bookkeeper.client.RegionAwareEnsemblePlacementPolicy.REPP_MINIMUM_REGIONS_FOR_DURABILITY;
import static org.apache.bookkeeper.client.RegionAwareEnsemblePlacementPolicy.REPP_REGIONS_TO_WRITE;
+import static org.apache.bookkeeper.net.CommonConfigurationKeys.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY;
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.util.Map;
@@ -180,6 +181,11 @@ public class BookKeeperClientFactoryImpl implements BookKeeperClientFactory {
REPP_DNS_RESOLVER_CLASS,
ZkBookieRackAffinityMapping.class.getName()));
+ bkConf.setProperty(NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
+ conf.getProperties().getProperty(
+ NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
+ ""));
+
ZooKeeperCache zkc = new ZooKeeperCache("bookies-racks", zkClient,
conf.getZooKeeperOperationTimeoutSeconds()) {
};
@@ -224,6 +230,11 @@ public class BookKeeperClientFactoryImpl implements BookKeeperClientFactory {
if (conf.isBookkeeperClientRackawarePolicyEnabled() || conf.isBookkeeperClientRegionawarePolicyEnabled()) {
bkConf.setProperty(REPP_DNS_RESOLVER_CLASS, conf.getProperties().getProperty(REPP_DNS_RESOLVER_CLASS,
ZkBookieRackAffinityMapping.class.getName()));
+
+ bkConf.setProperty(NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
+ conf.getProperties().getProperty(
+ NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
+ ""));
}
}