You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ta...@apache.org on 2025/06/13 02:53:49 UTC
(hbase) branch branch-3 updated: HBASE-29377 ChaosService support for custom ports in zookeeper quorum (#7072) (#7097)
This is an automated email from the ASF dual-hosted git repository.
taklwu pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-3 by this push:
new 3cc738cf45b HBASE-29377 ChaosService support for custom ports in zookeeper quorum (#7072) (#7097)
3cc738cf45b is described below
commit 3cc738cf45bb82fe0735a922ec3e75756bf42e41
Author: Ronald MacMaster <ro...@gmail.com>
AuthorDate: Thu Jun 12 22:53:43 2025 -0400
HBASE-29377 ChaosService support for custom ports in zookeeper quorum (#7072) (#7097)
Reviewed-by: Aman Poonia <am...@gmail.com>
Reviewed-by: Lokesh Khurana <kh...@gmail.com>
Signed-off-by: Tak Lon (Stephen) Wu <ta...@apache.org>
Co-authored-by: rmacmaster <rm...@bloomberg.net>
---
.../apache/hadoop/hbase/chaos/ChaosService.java | 9 ++++-
.../org/apache/hadoop/hbase/chaos/ChaosUtils.java | 45 ----------------------
2 files changed, 7 insertions(+), 47 deletions(-)
diff --git a/hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosService.java b/hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosService.java
index c65a88e0a74..26795135623 100644
--- a/hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosService.java
+++ b/hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosService.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hbase.chaos;
+import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collection;
@@ -25,6 +26,7 @@ import org.apache.hadoop.hbase.AuthUtil;
import org.apache.hadoop.hbase.ChoreService;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.zookeeper.ZKConfig;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
@@ -76,8 +78,11 @@ public class ChaosService {
case CHAOSAGENT:
ChaosAgent.stopChaosAgent.set(false);
try {
- Thread t = new Thread(
- new ChaosAgent(conf, ChaosUtils.getZKQuorum(conf), ChaosUtils.getHostName()));
+ String hostname = InetAddress.getLocalHost().getHostName();
+ String quorum = ZKConfig.getZKQuorumServersString(conf);
+ LOG.info("Starting the ChaosAgent with hostname: {}, quorum: {}", hostname, quorum);
+
+ Thread t = new Thread(new ChaosAgent(conf, quorum, hostname));
t.start();
t.join();
} catch (InterruptedException | UnknownHostException e) {
diff --git a/hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosUtils.java b/hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosUtils.java
deleted file mode 100644
index 7a91be861db..00000000000
--- a/hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosUtils.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.chaos;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.yetus.audience.InterfaceAudience;
-
-/**
- * ChaosUtils holds a bunch of useful functions like getting hostname and getting ZooKeeper quorum.
- */
-@InterfaceAudience.Private
-public class ChaosUtils {
-
- public static String getHostName() throws UnknownHostException {
- return InetAddress.getLocalHost().getHostName();
- }
-
- public static String getZKQuorum(Configuration conf) {
- String port = Integer.toString(conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT, 2181));
- String[] serverHosts = conf.getStrings(HConstants.ZOOKEEPER_QUORUM, "localhost");
- for (int i = 0; i < serverHosts.length; i++) {
- serverHosts[i] = serverHosts[i] + ":" + port;
- }
- return String.join(",", serverHosts);
- }
-
-}