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 04:38:50 GMT
Repository: hbase
Updated Branches:
  refs/heads/master afd7a8f47 -> 6c427175b


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/6c427175
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6c427175
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6c427175

Branch: refs/heads/master
Commit: 6c427175b826ad54ccb4ca4a65b1cd9aeeb6fdc6
Parents: afd7a8f
Author: Jerry He <jerryjch@apache.org>
Authored: Wed Apr 22 21:19:10 2015 -0700
Committer: Jerry He <jerryjch@apache.org>
Committed: Wed Apr 22 21:19:10 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/6c427175/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 ebb8209..0bd4f3f 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
@@ -92,6 +92,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();
@@ -101,7 +103,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");
@@ -126,8 +128,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);
@@ -136,6 +137,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.
@@ -170,6 +181,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