From cbf5cf58196b05a35b31385c6a42098c598c9b33 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Wed, 19 Oct 2022 21:22:16 -0700 Subject: [PATCH] [fix] The Pulsar standalone bookie is not getting passed the config from standalone.conf (#18126) --- .../main/java/org/apache/pulsar/PulsarStandalone.java | 4 ++++ .../apache/pulsar/metadata/bookkeeper/BKCluster.java | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java index ce46d460d5269..e0ebcc7657c2c 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java @@ -441,7 +441,11 @@ private void startBookieWithMetadataStore() throws Exception { } else { log.info("Starting BK with metadata store:", metadataStoreUrl); } + + ServerConfiguration bkServerConf = new ServerConfiguration(); + bkServerConf.loadConf(new File(configFile).toURI().toURL()); bkCluster = BKCluster.builder() + .baseServerConfiguration(bkServerConf) .metadataServiceUri(metadataStoreUrl) .bkPort(bkPort) .numBookies(numOfBk) diff --git a/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/BKCluster.java b/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/BKCluster.java index d845f912d2e18..6505868331fac 100644 --- a/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/BKCluster.java +++ b/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/BKCluster.java @@ -71,6 +71,8 @@ public class BKCluster implements AutoCloseable { protected final ClientConfiguration baseClientConf; public static class BKClusterConf { + + private ServerConfiguration baseServerConfiguration; private String metadataServiceUri; private int numBookies = 1; private String dataDir; @@ -78,6 +80,11 @@ public static class BKClusterConf { private boolean clearOldData; + public BKClusterConf baseServerConfiguration(ServerConfiguration baseServerConfiguration) { + this.baseServerConfiguration = baseServerConfiguration; + return this; + } + public BKClusterConf metadataServiceUri(String metadataServiceUri) { this.metadataServiceUri = metadataServiceUri; return this; @@ -115,7 +122,8 @@ public static BKClusterConf builder() { private BKCluster(BKClusterConf bkClusterConf) throws Exception { this.clusterConf = bkClusterConf; - this.baseConf = newBaseServerConfiguration(); + this.baseConf = bkClusterConf.baseServerConfiguration != null + ? bkClusterConf.baseServerConfiguration : newBaseServerConfiguration(); this.baseClientConf = newBaseClientConfiguration(); this.store =