hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerry...@apache.org
Subject hbase git commit: HBASE-13526 TestRegionServerReportForDuty can be flaky: hang or timeout
Date Thu, 23 Apr 2015 06:15:56 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 3d285cbad -> 67b8fa8ca


HBASE-13526 TestRegionServerReportForDuty can be flaky: hang or timeout


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/67b8fa8c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/67b8fa8c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/67b8fa8c

Branch: refs/heads/branch-1.0
Commit: 67b8fa8ca3c164502307251459cf3a50717be704
Parents: 3d285cb
Author: Jerry He <jerryjch@apache.org>
Authored: Wed Apr 22 23:07:09 2015 -0700
Committer: Jerry He <jerryjch@apache.org>
Committed: Wed Apr 22 23:07:09 2015 -0700

----------------------------------------------------------------------
 .../TestRegionServerReportForDuty.java            | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/67b8fa8c/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java
index 28e2c17..5778c6c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java
@@ -91,6 +91,8 @@ public class TestRegionServerReportForDuty {
     master.start();
     rs.start();
 
+    waitForClusterOnline(master);
+
     // Add a 2nd region server
     cluster.getConfiguration().set(HConstants.REGION_SERVER_IMPL, MyRegionServer.class.getName());
     rs2 = cluster.addRegionServer();
@@ -100,7 +102,7 @@ public class TestRegionServerReportForDuty {
     LOG.debug("Starting 2nd region server: " + rs2.getRegionServer().getServerName());
     rs2.start();
 
-    waitForClusterOnline(master);
+    waitForSecondRsStarted();
 
     // Stop the current master.
     master.getMaster().stop("Stopping master");
@@ -125,8 +127,7 @@ public class TestRegionServerReportForDuty {
 
   private void waitForClusterOnline(MasterThread master) throws InterruptedException {
     while (true) {
-      if (master.getMaster().isInitialized()
-          && ((MyRegionServer) rs2.getRegionServer()).getRpcStubCreatedFlag() ==
true) {
+      if (master.getMaster().isInitialized()) {
         break;
       }
       Thread.sleep(SLEEP_INTERVAL);
@@ -135,6 +136,16 @@ public class TestRegionServerReportForDuty {
     rs.waitForServerOnline();
   }
 
+  private void waitForSecondRsStarted() throws InterruptedException {
+    while (true) {
+      if (((MyRegionServer) rs2.getRegionServer()).getRpcStubCreatedFlag() == true) {
+        break;
+      }
+      Thread.sleep(SLEEP_INTERVAL);
+      LOG.debug("Waiting 2nd RS to be started ...");
+    }
+  }
+
   // Create a Region Server that provide a hook so that we can wait for the master switch
over
   // before continuing reportForDuty to the mater.
   // The idea is that we get a RPC connection to the first active master, then we wait.
@@ -169,6 +180,7 @@ public class TestRegionServerReportForDuty {
         try {
           Thread.sleep(SLEEP_INTERVAL);
         } catch (InterruptedException e) {
+          return null;
         }
         LOG.debug("Waiting for master switch over ... ");
       }


Mime
View raw message