You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2024/06/10 19:33:06 UTC
(pulsar) branch branch-3.0 updated (477499d4fab -> d9928ef944f)
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a change to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
from 477499d4fab [improve][ci] Migrate from Gradle Enterprise to Develocity (#22880)
new efa5e8b0401 [fix] Remove blocking calls from BookieRackAffinityMapping (#22846)
new a7cb5ec9c5f [fix][cli] Fix the shell script parameter passthrough syntax (#22867)
new ebb4282949e [fix][cli] Fix Pulsar standalone shutdown - bkCluster wasn't closed (#22868)
new d9928ef944f [fix][cli] Fix Pulsar standalone "--wipe-data" (#22885)
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
bin/bookkeeper | 12 ++---
bin/pulsar | 38 +++++++-------
.../rackawareness/BookieRackAffinityMapping.java | 44 +++++++++-------
.../IsolatedBookieEnsemblePlacementPolicy.java | 2 +-
.../java/org/apache/pulsar/PulsarStandalone.java | 19 ++++++-
.../org/apache/pulsar/PulsarStandaloneStarter.java | 58 ++++++++++++++++------
.../pulsar/zookeeper/LocalBookkeeperEnsemble.java | 2 +
.../org/apache/pulsar/PulsarStandaloneTest.java | 48 ++++++++++++++++--
.../configurations/pulsar_broker_test.conf | 26 +++++-----
.../pulsar_broker_test_standalone.conf | 26 +++++-----
...pulsar_broker_test_standalone_with_rocksdb.conf | 26 +++++-----
.../configurations/standalone_no_client_auth.conf | 4 +-
.../pulsar/metadata/bookkeeper/BKCluster.java | 44 ++++++++++------
13 files changed, 231 insertions(+), 118 deletions(-)
(pulsar) 03/04: [fix][cli] Fix Pulsar standalone shutdown - bkCluster wasn't closed (#22868)
Posted by lh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit ebb4282949e53ecf2229525d840143830beec89b
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Fri Jun 7 18:36:52 2024 +0300
[fix][cli] Fix Pulsar standalone shutdown - bkCluster wasn't closed (#22868)
(cherry picked from commit c5cc25ebdc3a32d002b944e77fb59c9ccd1f14c1)
---
.../java/org/apache/pulsar/PulsarStandalone.java | 10 ++++
.../org/apache/pulsar/PulsarStandaloneStarter.java | 58 ++++++++++++++++------
.../org/apache/pulsar/PulsarStandaloneTest.java | 48 ++++++++++++++++--
.../configurations/pulsar_broker_test.conf | 26 +++++-----
.../pulsar_broker_test_standalone.conf | 26 +++++-----
...pulsar_broker_test_standalone_with_rocksdb.conf | 26 +++++-----
.../configurations/standalone_no_client_auth.conf | 4 +-
.../pulsar/metadata/bookkeeper/BKCluster.java | 43 ++++++++++------
8 files changed, 167 insertions(+), 74 deletions(-)
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 ba136e7c910..a2a101fe394 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java
@@ -417,18 +417,22 @@ public class PulsarStandalone implements AutoCloseable {
try {
if (fnWorkerService != null) {
fnWorkerService.stop();
+ fnWorkerService = null;
}
if (broker != null) {
broker.close();
+ broker = null;
}
if (bkCluster != null) {
bkCluster.close();
+ bkCluster = null;
}
if (bkEnsemble != null) {
bkEnsemble.stop();
+ bkEnsemble = null;
}
} catch (Exception e) {
log.error("Shutdown failed: {}", e.getMessage(), e);
@@ -493,5 +497,11 @@ public class PulsarStandalone implements AutoCloseable {
ShutdownUtil.triggerImmediateForcefulShutdown(exitCode);
}
+ public String getBrokerServiceUrl() {
+ return broker.getBrokerServiceUrl();
+ }
+ public String getWebServiceUrl() {
+ return broker.getWebServiceAddress();
+ }
}
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
index 33dd58deac0..b84b829d9b1 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
@@ -21,9 +21,12 @@ package org.apache.pulsar;
import static org.apache.commons.lang3.StringUtils.isBlank;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import java.io.FileInputStream;
import java.util.Arrays;
+import lombok.AccessLevel;
+import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
@@ -38,6 +41,9 @@ public class PulsarStandaloneStarter extends PulsarStandalone {
@Parameter(names = {"-g", "--generate-docs"}, description = "Generate docs")
private boolean generateDocs = false;
+ private Thread shutdownThread;
+ @Setter(AccessLevel.PACKAGE)
+ private boolean testMode;
public PulsarStandaloneStarter(String[] args) throws Exception {
@@ -108,26 +114,50 @@ public class PulsarStandaloneStarter extends PulsarStandalone {
}
}
}
+ }
- Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+ @Override
+ public synchronized void start() throws Exception {
+ super.start();
+ if (shutdownThread != null) {
+ throw new IllegalStateException("Shutdown hook already registered");
+ }
+ shutdownThread = new Thread(() -> {
try {
- if (fnWorkerService != null) {
- fnWorkerService.stop();
- }
-
- if (broker != null) {
- broker.close();
- }
-
- if (bkEnsemble != null) {
- bkEnsemble.stop();
- }
+ doClose(false);
} catch (Exception e) {
log.error("Shutdown failed: {}", e.getMessage(), e);
} finally {
- LogManager.shutdown();
+ if (!testMode) {
+ LogManager.shutdown();
+ }
}
- }));
+ });
+ Runtime.getRuntime().addShutdownHook(shutdownThread);
+ }
+
+ // simulate running the shutdown hook, for testing
+ @VisibleForTesting
+ void runShutdownHook() {
+ if (!testMode) {
+ throw new IllegalStateException("Not in test mode");
+ }
+ Runtime.getRuntime().removeShutdownHook(shutdownThread);
+ shutdownThread.run();
+ shutdownThread = null;
+ }
+
+ @Override
+ public void close() {
+ doClose(true);
+ }
+
+ private synchronized void doClose(boolean removeShutdownHook) {
+ super.close();
+ if (shutdownThread != null && removeShutdownHook) {
+ Runtime.getRuntime().removeShutdownHook(shutdownThread);
+ shutdownThread = null;
+ }
}
private static boolean argsContains(String[] args, String arg) {
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java
index 6ed93a75a3f..3d22feb822e 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java
@@ -31,6 +31,7 @@ import org.apache.bookkeeper.util.IOUtils;
import org.apache.pulsar.client.admin.PulsarAdmin;
import org.apache.pulsar.common.policies.data.ClusterData;
import org.apache.pulsar.common.policies.data.TenantInfo;
+import org.apache.pulsar.metadata.bookkeeper.BKCluster;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -46,12 +47,15 @@ public class PulsarStandaloneTest {
@Test
public void testStandaloneWithRocksDB() throws Exception {
String[] args = new String[]{"--config",
- "./src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf"};
+ "./src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf",
+ "-nss",
+ "-nfw"};
final int bookieNum = 3;
final File tempDir = IOUtils.createTempDir("standalone", "test");
PulsarStandaloneStarter standalone = new PulsarStandaloneStarter(args);
standalone.setBkDir(tempDir.getAbsolutePath());
+ standalone.setBkPort(0);
standalone.setNumOfBk(bookieNum);
standalone.startBookieWithMetadataStore();
@@ -90,11 +94,12 @@ public class PulsarStandaloneTest {
}
final File bkDir = IOUtils.createTempDir("standalone", "bk");
standalone.setNumOfBk(1);
+ standalone.setBkPort(0);
standalone.setBkDir(bkDir.getAbsolutePath());
standalone.start();
@Cleanup PulsarAdmin admin = PulsarAdmin.builder()
- .serviceHttpUrl("http://localhost:8080")
+ .serviceHttpUrl(standalone.getWebServiceUrl())
.authentication(new MockTokenAuthenticationProvider.MockAuthentication())
.build();
if (enableBrokerClientAuth) {
@@ -104,8 +109,8 @@ public class PulsarStandaloneTest {
} else {
assertTrue(admin.clusters().getClusters().isEmpty());
admin.clusters().createCluster("test_cluster", ClusterData.builder()
- .serviceUrl("http://localhost:8080/")
- .brokerServiceUrl("pulsar://localhost:6650/")
+ .serviceUrl(standalone.getWebServiceUrl())
+ .brokerServiceUrl(standalone.getBrokerServiceUrl())
.build());
assertTrue(admin.tenants().getTenants().isEmpty());
admin.tenants().createTenant("public", TenantInfo.builder()
@@ -125,4 +130,39 @@ public class PulsarStandaloneTest {
cleanDirectory(bkDir);
cleanDirectory(metadataDir);
}
+
+
+ @Test
+ public void testShutdownHookClosesBkCluster() throws Exception {
+ File dataDir = IOUtils.createTempDir("data", "");
+ File metadataDir = new File(dataDir, "metadata");
+ File bkDir = new File(dataDir, "bookkeeper");
+ @Cleanup
+ PulsarStandaloneStarter standalone = new PulsarStandaloneStarter(new String[] {
+ "--config",
+ "./src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf",
+ "-nss",
+ "-nfw",
+ "--metadata-dir",
+ metadataDir.getAbsolutePath(),
+ "--bookkeeper-dir",
+ bkDir.getAbsolutePath()
+ });
+ standalone.setTestMode(true);
+ standalone.setBkPort(0);
+ standalone.start();
+ BKCluster bkCluster = standalone.bkCluster;
+ standalone.runShutdownHook();
+ assertTrue(bkCluster.isClosed());
+ }
+
+ @Test
+ public void testWipeData() throws Exception {
+ PulsarStandaloneStarter standalone = new PulsarStandaloneStarter(new String[] {
+ "--config",
+ "./src/test/resources/configurations/standalone_no_client_auth.conf",
+ "--wipe-data"
+ });
+ assertTrue(standalone.isWipeData());
+ }
}
diff --git a/pulsar-broker/src/test/resources/configurations/pulsar_broker_test.conf b/pulsar-broker/src/test/resources/configurations/pulsar_broker_test.conf
index bfbbfb7487c..36f5869d73d 100644
--- a/pulsar-broker/src/test/resources/configurations/pulsar_broker_test.conf
+++ b/pulsar-broker/src/test/resources/configurations/pulsar_broker_test.conf
@@ -17,17 +17,17 @@
# under the License.
#
-applicationName="pulsar_broker"
-zookeeperServers="localhost"
-configurationStoreServers="localhost"
+applicationName=pulsar_broker
+zookeeperServers=localhost
+configurationStoreServers=localhost
brokerServicePort=6650
-brokerServicePortTls=6651
+brokerServicePortTls=
webServicePort=8080
-webServicePortTls=4443
+webServicePortTls=
httpMaxRequestHeaderSize=1234
bindAddress=0.0.0.0
advertisedAddress=
-clusterName="test_cluster"
+clusterName=test_cluster
brokerShutdownTimeoutMs=3000
backlogQuotaCheckEnabled=true
backlogQuotaCheckIntervalInSeconds=60
@@ -42,17 +42,17 @@ clientLibraryVersionCheckEnabled=false
clientLibraryVersionCheckAllowUnversioned=true
statusFilePath=/tmp/status.html
tlsEnabled=false
-tlsCertificateFilePath=/usr/local/conf/pulsar/server.crt
-tlsKeyFilePath=/home/local/conf/pulsar/server.key
+tlsCertificateFilePath=
+tlsKeyFilePath=
tlsTrustCertsFilePath=
tlsAllowInsecureConnection=false
authenticationEnabled=false
authorizationEnabled=false
-superUserRoles="test_user"
-brokerClientAuthenticationPlugin="org.apache.pulsar.client.impl.auth.AuthenticationDisabled"
+superUserRoles=test_user
+brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationDisabled
brokerClientAuthenticationParameters=
-bookkeeperClientAuthenticationPlugin="test_auth_plugin"
-bookkeeperClientAuthenticationAppId="test_auth_id"
+bookkeeperClientAuthenticationPlugin=
+bookkeeperClientAuthenticationAppId=test_auth_id
bookkeeperClientTimeoutInSeconds=30
bookkeeperClientSpeculativeReadTimeoutInMillis=0
bookkeeperClientHealthCheckEnabled=true
@@ -64,7 +64,7 @@ bookkeeperClientRegionawarePolicyEnabled=false
bookkeeperClientMinNumRacksPerWriteQuorum=2
bookkeeperClientEnforceMinNumRacksPerWriteQuorum=false
bookkeeperClientReorderReadSequenceEnabled=false
-bookkeeperClientIsolationGroups="test_group"
+bookkeeperClientIsolationGroups=test_group
managedLedgerDefaultEnsembleSize=3
managedLedgerDefaultWriteQuorum=2
managedLedgerDefaultAckQuorum=2
diff --git a/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone.conf b/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone.conf
index c733409fc00..0748418be63 100644
--- a/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone.conf
+++ b/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone.conf
@@ -17,18 +17,18 @@
# under the License.
#
-applicationName="pulsar_broker"
-metadataStoreUrl="zk:localhost:2181/ledger"
-configurationMetadataStoreUrl="zk:localhost:2181"
-brokerServicePort=6650
-brokerServicePortTls=6651
-webServicePort=8080
-webServicePortTls=4443
+applicationName=pulsar_broker
+metadataStoreUrl=zk:localhost:2181/ledger
+configurationMetadataStoreUrl=zk:localhost:2181
+brokerServicePort=0
+brokerServicePortTls=
+webServicePort=0
+webServicePortTls=
bindAddress=0.0.0.0
advertisedAddress=
advertisedListeners=internal:pulsar://192.168.1.11:6660,internal:pulsar+ssl://192.168.1.11:6651
internalListenerName=internal
-clusterName="test_cluster"
+clusterName=test_cluster
brokerShutdownTimeoutMs=3000
backlogQuotaCheckEnabled=true
backlogQuotaCheckIntervalInSeconds=60
@@ -49,11 +49,11 @@ tlsTrustCertsFilePath=
tlsAllowInsecureConnection=false
authenticationEnabled=false
authorizationEnabled=false
-superUserRoles="test_user"
-brokerClientAuthenticationPlugin="org.apache.pulsar.client.impl.auth.AuthenticationDisabled"
+superUserRoles=test_user
+brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationDisabled
brokerClientAuthenticationParameters=
-bookkeeperClientAuthenticationPlugin="test_auth_plugin"
-bookkeeperClientAuthenticationAppId="test_auth_id"
+bookkeeperClientAuthenticationPlugin=
+bookkeeperClientAuthenticationAppId=
bookkeeperClientTimeoutInSeconds=30
bookkeeperClientSpeculativeReadTimeoutInMillis=0
bookkeeperClientHealthCheckEnabled=true
@@ -65,7 +65,7 @@ bookkeeperClientRegionawarePolicyEnabled=false
bookkeeperClientMinNumRacksPerWriteQuorum=2
bookkeeperClientEnforceMinNumRacksPerWriteQuorum=false
bookkeeperClientReorderReadSequenceEnabled=false
-bookkeeperClientIsolationGroups="test_group"
+bookkeeperClientIsolationGroups=
managedLedgerDefaultEnsembleSize=3
managedLedgerDefaultWriteQuorum=2
managedLedgerDefaultAckQuorum=2
diff --git a/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf b/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf
index d8b26bbbfa9..46c876686b0 100644
--- a/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf
+++ b/pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf
@@ -17,19 +17,19 @@
# under the License.
#
-applicationName="pulsar_broker"
+applicationName=pulsar_broker
metadataStoreUrl=
configurationMetadataStoreUrl=
-brokerServicePort=6650
-brokerServicePortTls=6651
-webServicePort=8080
+brokerServicePort=0
+brokerServicePortTls=
+webServicePort=0
allowLoopback=true
-webServicePortTls=4443
+webServicePortTls=
bindAddress=0.0.0.0
advertisedAddress=
advertisedListeners=
internalListenerName=internal
-clusterName="test_cluster"
+clusterName=test_cluster
brokerShutdownTimeoutMs=3000
backlogQuotaCheckEnabled=true
backlogQuotaCheckIntervalInSeconds=60
@@ -44,17 +44,17 @@ clientLibraryVersionCheckEnabled=false
clientLibraryVersionCheckAllowUnversioned=true
statusFilePath=/tmp/status.html
tlsEnabled=false
-tlsCertificateFilePath=/usr/local/conf/pulsar/server.crt
-tlsKeyFilePath=/home/local/conf/pulsar/server.key
+tlsCertificateFilePath=
+tlsKeyFilePath=
tlsTrustCertsFilePath=
tlsAllowInsecureConnection=false
authenticationEnabled=false
authorizationEnabled=false
-superUserRoles="test_user"
-brokerClientAuthenticationPlugin="org.apache.pulsar.client.impl.auth.AuthenticationDisabled"
+superUserRoles=test_user
+brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationDisabled
brokerClientAuthenticationParameters=
-bookkeeperClientAuthenticationPlugin="test_auth_plugin"
-bookkeeperClientAuthenticationAppId="test_auth_id"
+bookkeeperClientAuthenticationPlugin=
+bookkeeperClientAuthenticationAppId=test_auth_id
bookkeeperClientTimeoutInSeconds=30
bookkeeperClientSpeculativeReadTimeoutInMillis=0
bookkeeperClientHealthCheckEnabled=true
@@ -66,7 +66,7 @@ bookkeeperClientRegionawarePolicyEnabled=false
bookkeeperClientMinNumRacksPerWriteQuorum=2
bookkeeperClientEnforceMinNumRacksPerWriteQuorum=false
bookkeeperClientReorderReadSequenceEnabled=false
-bookkeeperClientIsolationGroups="test_group"
+bookkeeperClientIsolationGroups=test_group
managedLedgerDefaultEnsembleSize=3
managedLedgerDefaultWriteQuorum=2
managedLedgerDefaultAckQuorum=2
diff --git a/pulsar-broker/src/test/resources/configurations/standalone_no_client_auth.conf b/pulsar-broker/src/test/resources/configurations/standalone_no_client_auth.conf
index 4e2fd402983..6f0d82cef17 100644
--- a/pulsar-broker/src/test/resources/configurations/standalone_no_client_auth.conf
+++ b/pulsar-broker/src/test/resources/configurations/standalone_no_client_auth.conf
@@ -17,8 +17,8 @@
# under the License.
#
-brokerServicePort=6650
-webServicePort=8080
+brokerServicePort=0
+webServicePort=0
allowLoopback=true
clusterName=test_cluster
superUserRoles=admin
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 c2f3f72ec21..8d3a90239ef 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
@@ -30,6 +30,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import lombok.Getter;
@@ -49,8 +50,8 @@ import org.apache.bookkeeper.proto.BookieServer;
import org.apache.bookkeeper.replication.AutoRecoveryMain;
import org.apache.bookkeeper.server.conf.BookieConfiguration;
import org.apache.bookkeeper.util.IOUtils;
-import org.apache.bookkeeper.util.PortManager;
import org.apache.commons.io.FileUtils;
+import org.apache.pulsar.common.util.PortManager;
import org.apache.pulsar.metadata.api.MetadataStoreConfig;
import org.apache.pulsar.metadata.api.extended.MetadataStoreExtended;
@@ -74,6 +75,9 @@ public class BKCluster implements AutoCloseable {
protected final ServerConfiguration baseConf;
protected final ClientConfiguration baseClientConf;
+ private final List<Integer> lockedPorts = new ArrayList<>();
+ private final AtomicBoolean closed = new AtomicBoolean(false);
+
public static class BKClusterConf {
private ServerConfiguration baseServerConfiguration;
@@ -148,20 +152,24 @@ public class BKCluster implements AutoCloseable {
@Override
public void close() throws Exception {
- // stop bookkeeper service
- try {
- stopBKCluster();
- } catch (Exception e) {
- log.error("Got Exception while trying to stop BKCluster", e);
- }
- // cleanup temp dirs
- try {
- cleanupTempDirs();
- } catch (Exception e) {
- log.error("Got Exception while trying to cleanupTempDirs", e);
- }
+ if (closed.compareAndSet(false, true)) {
+ // stop bookkeeper service
+ try {
+ stopBKCluster();
+ } catch (Exception e) {
+ log.error("Got Exception while trying to stop BKCluster", e);
+ }
+ lockedPorts.forEach(PortManager::releaseLockedPort);
+ lockedPorts.clear();
+ // cleanup temp dirs
+ try {
+ cleanupTempDirs();
+ } catch (Exception e) {
+ log.error("Got Exception while trying to cleanupTempDirs", e);
+ }
- this.store.close();
+ this.store.close();
+ }
}
private File createTempDir(String prefix, String suffix) throws IOException {
@@ -229,7 +237,8 @@ public class BKCluster implements AutoCloseable {
int port;
if (baseConf.isEnableLocalTransport() || !baseConf.getAllowEphemeralPorts() || clusterConf.bkPort == 0) {
- port = PortManager.nextFreePort();
+ port = PortManager.nextLockedFreePort();
+ lockedPorts.add(port);
} else {
// bk 4.15 cookie validation finds the same ip:port in case of port 0
// and 2nd bookie's cookie validation fails
@@ -399,4 +408,8 @@ public class BKCluster implements AutoCloseable {
serverConf.setAllowLoopback(true);
return serverConf;
}
+
+ public boolean isClosed() {
+ return closed.get();
+ }
}
(pulsar) 02/04: [fix][cli] Fix the shell script parameter passthrough syntax (#22867)
Posted by lh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit a7cb5ec9c5f9238cbb8c1a9ecdd13f32636c4da5
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Fri Jun 7 15:25:35 2024 +0300
[fix][cli] Fix the shell script parameter passthrough syntax (#22867)
(cherry picked from commit c81c0f684f8c55c2e39739c6e1de935dff2085d6)
---
bin/bookkeeper | 12 ++++++------
bin/pulsar | 38 +++++++++++++++++++-------------------
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/bin/bookkeeper b/bin/bookkeeper
index 0cc07dd49ab..13d092f4c99 100755
--- a/bin/bookkeeper
+++ b/bin/bookkeeper
@@ -214,20 +214,20 @@ OPTS="$OPTS $BK_METADATA_OPTIONS"
#Change to BK_HOME to support relative paths
cd "$BK_HOME"
if [ $COMMAND == "bookie" ]; then
- exec $JAVA $OPTS $JMX_ARGS org.apache.bookkeeper.server.Main --conf $BOOKIE_CONF $@
+ exec $JAVA $OPTS $JMX_ARGS org.apache.bookkeeper.server.Main --conf $BOOKIE_CONF "$@"
elif [ $COMMAND == "autorecovery" ]; then
- exec $JAVA $OPTS $JMX_ARGS org.apache.bookkeeper.replication.AutoRecoveryMain --conf $BOOKIE_CONF $@
+ exec $JAVA $OPTS $JMX_ARGS org.apache.bookkeeper.replication.AutoRecoveryMain --conf $BOOKIE_CONF "$@"
elif [ $COMMAND == "localbookie" ]; then
NUMBER=$1
shift
- exec $JAVA $OPTS $JMX_ARGS org.apache.bookkeeper.util.LocalBookKeeper $NUMBER $BOOKIE_CONF $@
+ exec $JAVA $OPTS $JMX_ARGS org.apache.bookkeeper.util.LocalBookKeeper $NUMBER $BOOKIE_CONF "$@"
elif [ $COMMAND == "upgrade" ]; then
- exec $JAVA $OPTS org.apache.bookkeeper.bookie.FileSystemUpgrade --conf $BOOKIE_CONF $@
+ exec $JAVA $OPTS org.apache.bookkeeper.bookie.FileSystemUpgrade --conf $BOOKIE_CONF "$@"
elif [ $COMMAND == "shell" ]; then
ENTRY_FORMATTER_ARG="-DentryFormatterClass=${ENTRY_FORMATTER_CLASS:-org.apache.bookkeeper.util.StringEntryFormatter}"
- exec $JAVA $OPTS $ENTRY_FORMATTER_ARG org.apache.bookkeeper.bookie.BookieShell -conf $BOOKIE_CONF $@
+ exec $JAVA $OPTS $ENTRY_FORMATTER_ARG org.apache.bookkeeper.bookie.BookieShell -conf $BOOKIE_CONF "$@"
elif [ $COMMAND == "help" -o $COMMAND == "--help" -o $COMMAND == "-h" ]; then
bookkeeper_help;
else
- exec $JAVA $OPTS $COMMAND $@
+ exec $JAVA $OPTS $COMMAND "$@"
fi
diff --git a/bin/pulsar b/bin/pulsar
index 20ed1f7f22b..272ed9b8225 100755
--- a/bin/pulsar
+++ b/bin/pulsar
@@ -364,52 +364,52 @@ fi
cd "$PULSAR_HOME"
if [ $COMMAND == "broker" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"pulsar-broker.log"}
- exec $JAVA $LOG4J2_SHUTDOWN_HOOK_DISABLED $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.PulsarBrokerStarter --broker-conf $PULSAR_BROKER_CONF $@
+ exec $JAVA $LOG4J2_SHUTDOWN_HOOK_DISABLED $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.PulsarBrokerStarter --broker-conf $PULSAR_BROKER_CONF "$@"
elif [ $COMMAND == "bookie" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"bookkeeper.log"}
- exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.bookkeeper.server.Main --conf $PULSAR_BOOKKEEPER_CONF $@
+ exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.bookkeeper.server.Main --conf $PULSAR_BOOKKEEPER_CONF "$@"
elif [ $COMMAND == "zookeeper" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"zookeeper.log"}
- exec $JAVA ${ZK_OPTS} $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.zookeeper.server.quorum.QuorumPeerMain $PULSAR_ZK_CONF $@
+ exec $JAVA ${ZK_OPTS} $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.zookeeper.server.quorum.QuorumPeerMain $PULSAR_ZK_CONF "$@"
elif [ $COMMAND == "global-zookeeper" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"global-zookeeper.log"}
# Allow global ZK to turn into read-only mode when it cannot reach the quorum
OPTS="${OPTS} ${ZK_OPTS} -Dreadonlymode.enabled=true"
- exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.zookeeper.server.quorum.QuorumPeerMain $PULSAR_GLOBAL_ZK_CONF $@
+ exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.zookeeper.server.quorum.QuorumPeerMain $PULSAR_GLOBAL_ZK_CONF "$@"
elif [ $COMMAND == "configuration-store" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"configuration-store.log"}
# Allow global ZK to turn into read-only mode when it cannot reach the quorum
OPTS="${OPTS} ${ZK_OPTS} -Dreadonlymode.enabled=true"
- exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.zookeeper.server.quorum.QuorumPeerMain $PULSAR_CONFIGURATION_STORE_CONF $@
+ exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.zookeeper.server.quorum.QuorumPeerMain $PULSAR_CONFIGURATION_STORE_CONF "$@"
elif [ $COMMAND == "proxy" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"pulsar-proxy.log"}
- exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.proxy.server.ProxyServiceStarter --config $PULSAR_PROXY_CONF $@
+ exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.proxy.server.ProxyServiceStarter --config $PULSAR_PROXY_CONF "$@"
elif [ $COMMAND == "websocket" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"pulsar-websocket.log"}
- exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.websocket.service.WebSocketServiceStarter $PULSAR_WEBSOCKET_CONF $@
+ exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.websocket.service.WebSocketServiceStarter $PULSAR_WEBSOCKET_CONF "$@"
elif [ $COMMAND == "functions-worker" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"pulsar-functions-worker.log"}
- exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.functions.worker.FunctionWorkerStarter -c $PULSAR_WORKER_CONF $@
+ exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.functions.worker.FunctionWorkerStarter -c $PULSAR_WORKER_CONF "$@"
elif [ $COMMAND == "standalone" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"pulsar-standalone.log"}
- exec $JAVA $LOG4J2_SHUTDOWN_HOOK_DISABLED $OPTS ${ZK_OPTS} -Dpulsar.log.file=$PULSAR_LOG_FILE -Dpulsar.config.file=$PULSAR_STANDALONE_CONF org.apache.pulsar.PulsarStandaloneStarter $@
+ exec $JAVA $LOG4J2_SHUTDOWN_HOOK_DISABLED $OPTS ${ZK_OPTS} -Dpulsar.log.file=$PULSAR_LOG_FILE -Dpulsar.config.file=$PULSAR_STANDALONE_CONF org.apache.pulsar.PulsarStandaloneStarter "$@"
elif [ ${COMMAND} == "autorecovery" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"pulsar-autorecovery.log"}
- exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.bookkeeper.replication.AutoRecoveryMain --conf $PULSAR_BOOKKEEPER_CONF $@
+ exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.bookkeeper.replication.AutoRecoveryMain --conf $PULSAR_BOOKKEEPER_CONF "$@"
elif [ $COMMAND == "initialize-cluster-metadata" ]; then
- exec $JAVA $OPTS org.apache.pulsar.PulsarClusterMetadataSetup $@
+ exec $JAVA $OPTS org.apache.pulsar.PulsarClusterMetadataSetup "$@"
elif [ $COMMAND == "delete-cluster-metadata" ]; then
- exec $JAVA $OPTS org.apache.pulsar.PulsarClusterMetadataTeardown $@
+ exec $JAVA $OPTS org.apache.pulsar.PulsarClusterMetadataTeardown "$@"
elif [ $COMMAND == "initialize-transaction-coordinator-metadata" ]; then
- exec $JAVA $OPTS org.apache.pulsar.PulsarTransactionCoordinatorMetadataSetup $@
+ exec $JAVA $OPTS org.apache.pulsar.PulsarTransactionCoordinatorMetadataSetup "$@"
elif [ $COMMAND == "initialize-namespace" ]; then
- exec $JAVA $OPTS org.apache.pulsar.PulsarInitialNamespaceSetup $@
+ exec $JAVA $OPTS org.apache.pulsar.PulsarInitialNamespaceSetup "$@"
elif [ $COMMAND == "zookeeper-shell" ]; then
- exec $JAVA $OPTS org.apache.zookeeper.ZooKeeperMain $@
+ exec $JAVA $OPTS org.apache.zookeeper.ZooKeeperMain "$@"
elif [ $COMMAND == "broker-tool" ]; then
- exec $JAVA $OPTS org.apache.pulsar.broker.tools.BrokerTool $@
+ exec $JAVA $OPTS org.apache.pulsar.broker.tools.BrokerTool "$@"
elif [ $COMMAND == "compact-topic" ]; then
- exec $JAVA $OPTS org.apache.pulsar.compaction.CompactorTool --broker-conf $PULSAR_BROKER_CONF $@
+ exec $JAVA $OPTS org.apache.pulsar.compaction.CompactorTool --broker-conf $PULSAR_BROKER_CONF "$@"
elif [ $COMMAND == "sql" ]; then
check_trino_libraries
exec $JAVA -cp "${TRINO_HOME}/lib/*" io.trino.cli.Trino --server localhost:8081 "${@}"
@@ -417,9 +417,9 @@ elif [ $COMMAND == "sql-worker" ]; then
check_trino_libraries
exec python3 ${TRINO_HOME}/bin/launcher.py --etc-dir ${PULSAR_TRINO_CONF} "${@}"
elif [ $COMMAND == "tokens" ]; then
- exec $JAVA $OPTS org.apache.pulsar.utils.auth.tokens.TokensCliUtils $@
+ exec $JAVA $OPTS org.apache.pulsar.utils.auth.tokens.TokensCliUtils "$@"
elif [ $COMMAND == "version" ]; then
- exec $JAVA $OPTS org.apache.pulsar.PulsarVersionStarter $@
+ exec $JAVA $OPTS org.apache.pulsar.PulsarVersionStarter "$@"
elif [ $COMMAND == "help" -o $COMMAND == "--help" -o $COMMAND == "-h" ]; then
pulsar_help;
else
(pulsar) 04/04: [fix][cli] Fix Pulsar standalone "--wipe-data" (#22885)
Posted by lh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit d9928ef944f5b2ac8eb2e817704a7d3b69e11d5e
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Mon Jun 10 19:30:24 2024 +0300
[fix][cli] Fix Pulsar standalone "--wipe-data" (#22885)
(cherry picked from commit f6eceedbded53cded4dd751206ebb51d2867e978)
---
.../src/main/java/org/apache/pulsar/PulsarStandalone.java | 9 ++++++++-
.../org/apache/pulsar/zookeeper/LocalBookkeeperEnsemble.java | 2 ++
.../java/org/apache/pulsar/metadata/bookkeeper/BKCluster.java | 1 +
3 files changed, 11 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 a2a101fe394..360f8caeba6 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java
@@ -18,6 +18,7 @@
*/
package org.apache.pulsar;
+import static org.apache.commons.io.FileUtils.cleanDirectory;
import static org.apache.pulsar.common.naming.NamespaceName.SYSTEM_NAMESPACE;
import static org.apache.pulsar.common.naming.SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN;
import com.beust.jcommander.Parameter;
@@ -25,6 +26,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
import io.netty.util.internal.PlatformDependent;
import java.io.File;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
@@ -443,7 +445,12 @@ public class PulsarStandalone implements AutoCloseable {
void startBookieWithMetadataStore() throws Exception {
if (StringUtils.isBlank(metadataStoreUrl)){
log.info("Starting BK with RocksDb metadata store");
- metadataStoreUrl = "rocksdb://" + Paths.get(metadataDir).toAbsolutePath();
+ Path metadataDirPath = Paths.get(metadataDir);
+ metadataStoreUrl = "rocksdb://" + metadataDirPath.toAbsolutePath();
+ if (wipeData && Files.exists(metadataDirPath)) {
+ log.info("Wiping RocksDb metadata store at {}", metadataStoreUrl);
+ cleanDirectory(metadataDirPath.toFile());
+ }
} else {
log.info("Starting BK with metadata store: {}", metadataStoreUrl);
}
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/zookeeper/LocalBookkeeperEnsemble.java b/pulsar-broker/src/main/java/org/apache/pulsar/zookeeper/LocalBookkeeperEnsemble.java
index 63d146a3a15..4c8d2dbbfa7 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/zookeeper/LocalBookkeeperEnsemble.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/zookeeper/LocalBookkeeperEnsemble.java
@@ -194,6 +194,7 @@ public class LocalBookkeeperEnsemble {
: createTempDirectory("zktest");
if (this.clearOldData) {
+ LOG.info("Wiping Zookeeper data directory at {}", zkDataDir.getAbsolutePath());
cleanDirectory(zkDataDir);
}
@@ -291,6 +292,7 @@ public class LocalBookkeeperEnsemble {
: createTempDirectory("bk" + i + "test");
if (this.clearOldData) {
+ LOG.info("Wiping Bookie data directory at {}", bkDataDir.getAbsolutePath());
cleanDirectory(bkDataDir);
}
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 8d3a90239ef..fe2b981ffe9 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
@@ -232,6 +232,7 @@ public class BKCluster implements AutoCloseable {
}
if (clusterConf.clearOldData && dataDir.exists()) {
+ log.info("Wiping Bookie data directory at {}", dataDir.getAbsolutePath());
cleanDirectory(dataDir);
}
(pulsar) 01/04: [fix] Remove blocking calls from BookieRackAffinityMapping (#22846)
Posted by lh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit efa5e8b04018356447ec1744c6e083430e8e1f05
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Wed Jun 5 10:49:00 2024 -0700
[fix] Remove blocking calls from BookieRackAffinityMapping (#22846)
(cherry picked from commit aece67e35ecec4a9d90a951b78cfc89ca6395054)
---
.../rackawareness/BookieRackAffinityMapping.java | 44 +++++++++++++---------
.../IsolatedBookieEnsemblePlacementPolicy.java | 2 +-
2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java
index 983822f2294..4a5ff746f40 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java
@@ -70,7 +70,7 @@ public class BookieRackAffinityMapping extends AbstractDNSToSwitchMapping
private BookiesRackConfiguration racksWithHost = new BookiesRackConfiguration();
private Map<String, BookieInfo> bookieInfoMap = new HashMap<>();
- public static MetadataStore createMetadataStore(Configuration conf) throws MetadataException {
+ static MetadataStore getMetadataStore(Configuration conf) throws MetadataException {
MetadataStore store;
Object storeProperty = conf.getProperty(METADATA_STORE_INSTANCE);
if (storeProperty != null) {
@@ -116,12 +116,20 @@ public class BookieRackAffinityMapping extends AbstractDNSToSwitchMapping
super.setConf(conf);
MetadataStore store;
try {
- store = createMetadataStore(conf);
- bookieMappingCache = store.getMetadataCache(BookiesRackConfiguration.class);
- store.registerListener(this::handleUpdates);
- racksWithHost = bookieMappingCache.get(BOOKIE_INFO_ROOT_PATH).get()
- .orElseGet(BookiesRackConfiguration::new);
- for (Map<String, BookieInfo> bookieMapping : racksWithHost.values()) {
+ store = getMetadataStore(conf);
+ } catch (MetadataException e) {
+ throw new RuntimeException(METADATA_STORE_INSTANCE + " failed to init BookieId list");
+ }
+
+ bookieMappingCache = store.getMetadataCache(BookiesRackConfiguration.class);
+ store.registerListener(this::handleUpdates);
+
+ try {
+ var racksWithHost = bookieMappingCache.get(BOOKIE_INFO_ROOT_PATH)
+ .thenApply(optRes -> optRes.orElseGet(BookiesRackConfiguration::new))
+ .get();
+
+ for (var bookieMapping : racksWithHost.values()) {
for (String address : bookieMapping.keySet()) {
bookieAddressListLastTime.add(BookieId.parse(address));
}
@@ -131,10 +139,12 @@ public class BookieRackAffinityMapping extends AbstractDNSToSwitchMapping
}
}
updateRacksWithHost(racksWithHost);
- watchAvailableBookies();
- } catch (InterruptedException | ExecutionException | MetadataException e) {
- throw new RuntimeException(METADATA_STORE_INSTANCE + " failed to init BookieId list");
+ } catch (ExecutionException | InterruptedException e) {
+ LOG.error("Failed to update rack info. ", e);
+ throw new RuntimeException(e);
}
+
+ watchAvailableBookies();
}
private void watchAvailableBookies() {
@@ -145,13 +155,13 @@ public class BookieRackAffinityMapping extends AbstractDNSToSwitchMapping
field.setAccessible(true);
RegistrationClient registrationClient = (RegistrationClient) field.get(bookieAddressResolver);
registrationClient.watchWritableBookies(versioned -> {
- try {
- racksWithHost = bookieMappingCache.get(BOOKIE_INFO_ROOT_PATH).get()
- .orElseGet(BookiesRackConfiguration::new);
- updateRacksWithHost(racksWithHost);
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Failed to update rack info. ", e);
- }
+ bookieMappingCache.get(BOOKIE_INFO_ROOT_PATH)
+ .thenApply(optRes -> optRes.orElseGet(BookiesRackConfiguration::new))
+ .thenAccept(this::updateRacksWithHost)
+ .exceptionally(ex -> {
+ LOG.error("Failed to update rack info. ", ex);
+ return null;
+ });
});
} catch (NoSuchFieldException | IllegalAccessException e) {
LOG.error("Failed watch available bookies.", e);
diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java
index c0645f87936..7acab5f5d71 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java
@@ -73,7 +73,7 @@ public class IsolatedBookieEnsemblePlacementPolicy extends RackawareEnsemblePlac
StatsLogger statsLogger, BookieAddressResolver bookieAddressResolver) {
MetadataStore store;
try {
- store = BookieRackAffinityMapping.createMetadataStore(conf);
+ store = BookieRackAffinityMapping.getMetadataStore(conf);
} catch (MetadataException e) {
throw new RuntimeException(METADATA_STORE_INSTANCE + " failed initialized");
}