hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1503470 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DispatchMergingRegionHandler.java
Date Mon, 15 Jul 2013 20:59:16 GMT
Author: stack
Date: Mon Jul 15 20:59:15 2013
New Revision: 1503470

URL: http://svn.apache.org/r1503470
Log:
HBASE-8943 TestRegionMergeTransactionOnCluster#testWholesomeMerge may fail due to race in
opening region

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DispatchMergingRegionHandler.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DispatchMergingRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DispatchMergingRegionHandler.java?rev=1503470&r1=1503469&r2=1503470&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DispatchMergingRegionHandler.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DispatchMergingRegionHandler.java
Mon Jul 15 20:59:15 2013
@@ -27,6 +27,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.RegionLoad;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.exceptions.RegionOpeningException;
 import org.apache.hadoop.hbase.executor.EventHandler;
 import org.apache.hadoop.hbase.executor.EventType;
 import org.apache.hadoop.hbase.master.CatalogJanitor;
@@ -117,6 +118,7 @@ public class DispatchMergingRegionHandle
 
       RegionPlan regionPlan = new RegionPlan(region_b, region_b_location,
           region_a_location);
+      LOG.info("Moving regions to same server for merge: " + regionPlan.toString());
       masterServices.getAssignmentManager().balance(regionPlan);
       while (!masterServices.isStopped()) {
         try {
@@ -143,19 +145,27 @@ public class DispatchMergingRegionHandle
     }
 
     if (onSameRS) {
-      try{
-        masterServices.getServerManager().sendRegionsMerge(region_a_location,
-            region_a, region_b, forcible);
-        LOG.info("Successfully send MERGE REGIONS RPC to server "
-            + region_a_location.toString() + " for region "
-            + region_a.getRegionNameAsString() + ","
-            + region_b.getRegionNameAsString() + ", focible=" + forcible);
-      } catch (IOException ie) {
-        LOG.info("Failed send MERGE REGIONS RPC to server "
-            + region_a_location.toString() + " for region "
-            + region_a.getRegionNameAsString() + ","
-            + region_b.getRegionNameAsString() + ", focible=" + forcible + ", "
-            + ie.getMessage());
+      startTime = EnvironmentEdgeManager.currentTimeMillis();
+      while (!masterServices.isStopped()) {
+        try {
+          masterServices.getServerManager().sendRegionsMerge(region_a_location,
+              region_a, region_b, forcible);
+          LOG.info("Sent merge to server " + region_a_location + " for region " +
+            region_a.getEncodedName() + "," + region_b.getEncodedName() + ", focible=" +
forcible);
+          break;
+        } catch (RegionOpeningException roe) {
+          if ((EnvironmentEdgeManager.currentTimeMillis() - startTime) > timeout) {
+            LOG.warn("Failed sending merge to " + region_a_location + " after " + timeout
+ "ms",
+              roe);
+            break;
+          }
+          // Do a retry since region should be online on RS immediately
+        } catch (IOException ie) {
+          LOG.warn("Failed sending merge to " + region_a_location + " for region " +
+            region_a.getEncodedName() + "," + region_b.getEncodedName() + ", focible=" +
forcible,
+            ie);
+          break;
+        }
       }
     } else {
       LOG.info("Cancel merging regions " + region_a.getRegionNameAsString()
@@ -164,5 +174,4 @@ public class DispatchMergingRegionHandle
           + (EnvironmentEdgeManager.currentTimeMillis() - startTime) + "ms");
     }
   }
-
-}
+}
\ No newline at end of file



Mime
View raw message