From 2f4ae522c308b639bb3a448329bb1e351f7f4749 Mon Sep 17 00:00:00 2001 From: Jianfei Jiang Date: Tue, 14 Apr 2020 04:46:37 +0800 Subject: [PATCH] HBASE-24132 Upgrade to Apache ZooKeeper 3.5.7 (#1453) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * HBASE-24132 Upgrade to Apache ZooKeeper 3.5.7 * HBASE-24132 Upgrade to Apache ZooKeeper 3.5.7 Co-authored-by: 姜建飞 10222269 Signed-off-by: Mate Szalay-Beko Signed-off-by: Norbert Kalmar Signed-off-by: stack Signed-off-by: Duo Zhang --- .../src/main/resources/supplemental-models.xml | 15 +++++++++++++++ .../hbase/tmpl/master/MasterStatusTmpl.jamon | 4 ++-- .../hbase/tmpl/regionserver/RSStatusTmpl.jamon | 4 ++-- .../assignment/TestRegionMoveAndAbandon.java | 3 +++ .../hadoop/hbase/zookeeper/HQuorumPeer.java | 4 ++-- .../hbase/zookeeper/MiniZooKeeperCluster.java | 9 +++++---- .../hadoop/hbase/zookeeper/ZKMainServer.java | 6 +++--- .../apache/hadoop/hbase/zookeeper/ZKWatcher.java | 4 ++++ pom.xml | 5 ++--- 9 files changed, 38 insertions(+), 16 deletions(-) diff --git a/hbase-resource-bundle/src/main/resources/supplemental-models.xml b/hbase-resource-bundle/src/main/resources/supplemental-models.xml index 2813219fd28..d755854cfbe 100644 --- a/hbase-resource-bundle/src/main/resources/supplemental-models.xml +++ b/hbase-resource-bundle/src/main/resources/supplemental-models.xml @@ -3196,4 +3196,19 @@ Copyright (c) 2007-2017 The JRuby project + + + jline + jline + JLine + 2.11 + + + BSD License + http://www.opensource.org/licenses/bsd-license.php + repo + + + + diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index 2921300a794..d7c52ec7404 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -328,8 +328,8 @@ AssignmentManager assignmentManager = master.getAssignmentManager(); ZooKeeper Client Version - <% org.apache.zookeeper.Version.getVersion() %>, revision=<% org.apache.zookeeper.Version.getRevision() %> - ZooKeeper client version and revision + <% org.apache.zookeeper.Version.getVersion() %>, revision=<% org.apache.zookeeper.Version.getRevisionHash() %> + ZooKeeper client version and revision hash ZooKeeper Client Compiled diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon index f07b8e76612..b21a9c34944 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon @@ -197,8 +197,8 @@ org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; ZooKeeper Client Version - <% org.apache.zookeeper.Version.getVersion() %>, revision=<% org.apache.zookeeper.Version.getRevision() %> - ZooKeeper client version and revision + <% org.apache.zookeeper.Version.getVersion() %>, revision=<% org.apache.zookeeper.Version.getRevisionHash() %> + ZooKeeper client version and revision hash ZooKeeper Client Compiled diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java index b237f9fb663..ce5727d6412 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java @@ -112,6 +112,9 @@ public class TestRegionMoveAndAbandon { cluster.killRegionServer(rs2.getServerName()); UTIL.waitFor(30_000, () -> rs2.isStopped() && !rs2.isAlive()); UTIL.waitFor(30_000, () -> rs1.isStopped() && !rs1.isAlive()); + // make sure none of regionserver threads is alive. + UTIL.waitFor(30_000, () -> + UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().isEmpty()); // Start up everything again LOG.info("Starting cluster"); UTIL.getMiniHBaseCluster().startMaster(); diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java index 01935158797..193b7c85c55 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.net.InetAddress; import java.net.NetworkInterface; -import java.net.UnknownHostException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Enumeration; @@ -42,6 +41,7 @@ import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; import org.apache.zookeeper.server.ServerConfig; import org.apache.zookeeper.server.ZooKeeperServerMain; +import org.apache.zookeeper.server.admin.AdminServer; import org.apache.zookeeper.server.quorum.QuorumPeerConfig; import org.apache.zookeeper.server.quorum.QuorumPeerMain; @@ -83,7 +83,7 @@ public final class HQuorumPeer { } private static void runZKServer(QuorumPeerConfig zkConfig) - throws UnknownHostException, IOException { + throws IOException, AdminServer.AdminServerException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java index 7f5d8a0cff4..bdf7bb5579d 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java @@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.net.Address; import org.apache.hadoop.hbase.util.Threads; import org.apache.yetus.audience.InterfaceAudience; +import org.apache.zookeeper.common.X509Exception; import org.apache.zookeeper.server.NIOServerCnxnFactory; import org.apache.zookeeper.server.ZooKeeperServer; import org.apache.zookeeper.server.persistence.FileTxnLog; @@ -419,8 +420,8 @@ public class MiniZooKeeperCluster { long start = System.currentTimeMillis(); while (true) { try { - send4LetterWord(HOST, port, "stat", (int)timeout); - } catch (IOException e) { + send4LetterWord(HOST, port, "stat", false, (int)timeout); + } catch (IOException | X509Exception.SSLContextException e) { return true; } @@ -442,7 +443,7 @@ public class MiniZooKeeperCluster { long start = System.currentTimeMillis(); while (true) { try { - String result = send4LetterWord(HOST, port, "stat", (int)timeout); + String result = send4LetterWord(HOST, port, "stat", false, (int)timeout); if (result.startsWith("Zookeeper version:") && !result.contains("READ-ONLY")) { return true; } else { @@ -451,7 +452,7 @@ public class MiniZooKeeperCluster { } catch (ConnectException e) { // ignore as this is expected, do not log stacktrace LOG.info("{}:{} not up: {}", HOST, port, e.toString()); - } catch (IOException e) { + } catch (IOException | X509Exception.SSLContextException e) { // ignore as this is expected LOG.info("{}:{} not up", HOST, port, e); } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java index b2478cee67a..d20b0eb5886 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java @@ -24,8 +24,8 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.yetus.audience.InterfaceAudience; -import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.ZooKeeperMain; +import org.apache.zookeeper.cli.CliException; /** @@ -57,11 +57,11 @@ public class ZKMainServer { /** * Run the command-line args passed. Calls System.exit when done. - * @throws KeeperException if an unexpected ZooKeeper exception happens * @throws IOException in case of a network failure * @throws InterruptedException if the ZooKeeper client closes + * @throws CliException if the ZooKeeper exception happens in cli command */ - void runCmdLine() throws KeeperException, IOException, InterruptedException { + void runCmdLine() throws IOException, InterruptedException, CliException { processCmd(this.cl); System.exit(0); } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index a39c4135c51..9774a51b88d 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -560,6 +560,10 @@ public class ZKWatcher implements Watcher, Abortable, Closeable { LOG.debug(prefix("Received Disconnected from ZooKeeper, ignoring")); break; + case Closed: + LOG.debug(prefix("ZooKeeper client closed, ignoring")); + break; + case Expired: String msg = prefix(this.identifier + " received expired from " + "ZooKeeper, aborting"); diff --git a/pom.xml b/pom.xml index 080cf041793..62c07a46fe3 100755 --- a/pom.xml +++ b/pom.xml @@ -1351,9 +1351,8 @@ 0.6.1 thrift 0.12.0 - 3.4.14 - - 0.9.94 + 3.5.7 + 2.11 1.7.30 4.0.3 2.4.1