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/17 15:37:26 UTC

[hbase] branch branch-2.4 updated: HBASE-26941 LocalHBaseCluster.waitOnRegionServer should not call join while interrupted (#4352)

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

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


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new d9f4c519ca9 HBASE-26941 LocalHBaseCluster.waitOnRegionServer should not call join while interrupted (#4352)
d9f4c519ca9 is described below

commit d9f4c519ca92c90ec9e499081d6e1a4c0daa3679
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Sun Apr 17 22:56:52 2022 +0800

    HBASE-26941 LocalHBaseCluster.waitOnRegionServer should not call join while interrupted (#4352)
    
    Signed-off-by: Xin Sun <dd...@gmail.com>
    (cherry picked from commit 35aa57e4452c6f0a7f5037371edca64163913345)
---
 .../java/org/apache/hadoop/hbase/LocalHBaseCluster.java   | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 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 ca7e82a6071..1c721eef5c4 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
@@ -310,15 +310,20 @@ public class LocalHBaseCluster {
    * @return Name of region server that just went down.
    */
   public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
+    boolean interrupted = false;
     while (rst.isAlive()) {
       try {
         LOG.info("Waiting on " + rst.getRegionServer().toString());
         rst.join();
       } catch (InterruptedException e) {
-        e.printStackTrace();
+        LOG.error("Interrupted while waiting for {} to finish. Retrying join", rst.getName(), e);
+        interrupted = true;
       }
     }
     regionThreads.remove(rst);
+    if (interrupted) {
+      Thread.currentThread().interrupt();
+    }
     return rst.getName();
   }
 
@@ -382,15 +387,21 @@ public class LocalHBaseCluster {
    * @return Name of master that just went down.
    */
   public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
+    boolean interrupted = false;
     while (masterThread.isAlive()) {
       try {
         LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
         masterThread.join();
       } catch (InterruptedException e) {
-        e.printStackTrace();
+        LOG.error("Interrupted while waiting for {} to finish. Retrying join",
+            masterThread.getName(), e);
+        interrupted = true;
       }
     }
     masterThreads.remove(masterThread);
+    if (interrupted) {
+      Thread.currentThread().interrupt();
+    }
     return masterThread.getName();
   }