You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2022/04/13 03:53:34 UTC

[hbase] branch branch-2 updated: Revert "HBASE-26941 LocalHBaseCluster.waitOnRegionServer should quit while thread is interrupted (#4333)"

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new b405a6f119 Revert "HBASE-26941 LocalHBaseCluster.waitOnRegionServer should quit while thread is interrupted (#4333)"
b405a6f119 is described below

commit b405a6f1199d83a17ec496f6094c0b58d352dfbd
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Wed Apr 13 11:53:19 2022 +0800

    Revert "HBASE-26941 LocalHBaseCluster.waitOnRegionServer should quit while thread is interrupted (#4333)"
    
    This reverts commit f8b2ac05185fd1b7b13a7b559136f01345bccaf2.
---
 .../org/apache/hadoop/hbase/LocalHBaseCluster.java | 25 ++++++++++++++--------
 .../org/apache/hadoop/hbase/MiniHBaseCluster.java  | 17 ++++-----------
 .../hbase/master/TestMasterMetricsWrapper.java     |  2 +-
 3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java
index 6ddae5fc4c..ca7e82a607 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java
@@ -300,7 +300,7 @@ public class LocalHBaseCluster {
    * Wait for the specified region server to stop. Removes this thread from list of running threads.
    * @return Name of region server that just went down.
    */
-  public String waitOnRegionServer(int serverNumber) throws InterruptedException {
+  public String waitOnRegionServer(int serverNumber) {
     JVMClusterUtil.RegionServerThread regionServerThread = this.regionThreads.get(serverNumber);
     return waitOnRegionServer(regionServerThread);
   }
@@ -309,11 +309,14 @@ public class LocalHBaseCluster {
    * Wait for the specified region server to stop. Removes this thread from list of running threads.
    * @return Name of region server that just went down.
    */
-  public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst)
-    throws InterruptedException {
+  public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
     while (rst.isAlive()) {
-      LOG.info("Waiting on " + rst.getRegionServer().toString());
-      rst.join();
+      try {
+        LOG.info("Waiting on " + rst.getRegionServer().toString());
+        rst.join();
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
     }
     regionThreads.remove(rst);
     return rst.getName();
@@ -369,7 +372,7 @@ public class LocalHBaseCluster {
    * Wait for the specified master to stop. Removes this thread from list of running threads.
    * @return Name of master that just went down.
    */
-  public String waitOnMaster(int serverNumber) throws InterruptedException {
+  public String waitOnMaster(int serverNumber) {
     JVMClusterUtil.MasterThread masterThread = this.masterThreads.get(serverNumber);
     return waitOnMaster(masterThread);
   }
@@ -378,10 +381,14 @@ public class LocalHBaseCluster {
    * Wait for the specified master to stop. Removes this thread from list of running threads.
    * @return Name of master that just went down.
    */
-  public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) throws InterruptedException {
+  public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
     while (masterThread.isAlive()) {
-      LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
-      masterThread.join();
+      try {
+        LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
+        masterThread.join();
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
     }
     masterThreads.remove(masterThread);
     return masterThread.getName();
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
index 66246bdebb..b5339d7201 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
@@ -19,7 +19,6 @@
 package org.apache.hadoop.hbase;
 
 import java.io.IOException;
-import java.io.InterruptedIOException;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -310,11 +309,7 @@ public class MiniHBaseCluster extends HBaseCluster {
   @Override
   public void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException {
     //ignore timeout for now
-    try {
-      waitOnRegionServer(getRegionServerIndex(serverName));
-    } catch (InterruptedException e) {
-      throw (InterruptedIOException) new InterruptedIOException().initCause(e);
-    }
+    waitOnRegionServer(getRegionServerIndex(serverName));
   }
 
   @Override
@@ -410,11 +405,7 @@ public class MiniHBaseCluster extends HBaseCluster {
   @Override
   public void waitForMasterToStop(ServerName serverName, long timeout) throws IOException {
     //ignore timeout for now
-    try {
-      waitOnMaster(getMasterIndex(serverName));
-    } catch (InterruptedException e) {
-      throw (InterruptedIOException) new InterruptedIOException().initCause(e);
-    }
+    waitOnMaster(getMasterIndex(serverName));
   }
 
   /**
@@ -545,7 +536,7 @@ public class MiniHBaseCluster extends HBaseCluster {
    * @param serverNumber
    * @return Name of region server that just went down.
    */
-  public String waitOnRegionServer(final int serverNumber) throws InterruptedException {
+  public String waitOnRegionServer(final int serverNumber) {
     return this.hbaseCluster.waitOnRegionServer(serverNumber);
   }
 
@@ -656,7 +647,7 @@ public class MiniHBaseCluster extends HBaseCluster {
    * @param serverNumber
    * @return Name of master that just went down.
    */
-  public String waitOnMaster(final int serverNumber) throws InterruptedException {
+  public String waitOnMaster(final int serverNumber) {
     return this.hbaseCluster.waitOnMaster(serverNumber);
   }
 
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java
index 871d0f1546..920fd2d59c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java
@@ -59,7 +59,7 @@ public class TestMasterMetricsWrapper {
   }
 
   @Test
-  public void testInfo() throws InterruptedException {
+  public void testInfo() {
     HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
     MetricsMasterWrapperImpl info = new MetricsMasterWrapperImpl(master);
     assertEquals(