hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1465063 - in /hbase/branches/0.94/src: main/java/org/apache/hadoop/hbase/regionserver/ test/java/org/apache/hadoop/hbase/master/ test/java/org/apache/hadoop/hbase/regionserver/handler/
Date Fri, 05 Apr 2013 17:42:30 GMT
Author: sershe
Date: Fri Apr  5 17:42:30 2013
New Revision: 1465063

URL: http://svn.apache.org/r1465063
Log:
HBASE-8150 server should not produce RAITE for already-opening region in 0.94 (because master
retry logic handles this case poorly)

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1465063&r1=1465062&r2=1465063&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Fri Apr  5 17:42:30 2013
@@ -2942,7 +2942,14 @@ public class HRegionServer implements HR
     }
     // Added to in-memory RS RIT that we are trying to open this region.
     // Clear it if we fail queuing an open executor.
-    addRegionsInTransition(region, OPEN);
+    boolean isNewRit = addRegionsInTransition(region, OPEN);
+    if (!isNewRit) {
+      // An open is in progress. This is supported, but let's log this.
+      LOG.info("Receiving OPEN for the region:" +
+          region.getRegionNameAsString() + " , which we are already trying to OPEN" +
+          " - ignoring this new request for this region.");
+      return RegionOpeningState.OPENED;
+    }
     try {
       LOG.info("Received request to open region: " +
         region.getRegionNameAsString());
@@ -3026,16 +3033,19 @@ public class HRegionServer implements HR
     *          Whether OPEN or CLOSE.
     * @throws RegionAlreadyInTransitionException
     */
-   protected void addRegionsInTransition(final HRegionInfo region, final String currentAction)
+   protected boolean addRegionsInTransition(final HRegionInfo region, final String currentAction)
        throws RegionAlreadyInTransitionException {
-     Boolean action = this.regionsInTransitionInRS.putIfAbsent(region.getEncodedNameAsBytes(),
-         currentAction.equals(OPEN));
-     if (action != null) {
-       // The below exception message will be used in master.
-       throw new RegionAlreadyInTransitionException("Received:" + currentAction + " for the
region:"
-           + region.getRegionNameAsString() + " for the region:" + region.getRegionNameAsString()
-           + ", which we are already trying to " + (action ? OPEN : CLOSE) + ".");
+     boolean isOpen = currentAction.equals(OPEN);
+     Boolean action = this.regionsInTransitionInRS.putIfAbsent(
+         region.getEncodedNameAsBytes(), isOpen);
+     if (action == null) return true;
+     if (isOpen && action.booleanValue()) {
+       return false;
      }
+     // The below exception message will be used in master.
+     throw new RegionAlreadyInTransitionException("Received:" + currentAction
+         + " for the region:" + region.getRegionNameAsString()
+         + ", which we are already trying to " + (action ? OPEN : CLOSE) + ".");
    }
 
   @Override

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java?rev=1465063&r1=1465062&r2=1465063&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
(original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
Fri Apr  5 17:42:30 2013
@@ -107,9 +107,9 @@ public class TestZKBasedOpenCloseRegion 
       super(conf);
     }
     @Override
-    public void addRegionsInTransition(HRegionInfo region,
+    public boolean addRegionsInTransition(HRegionInfo region,
         String currentAction) throws RegionAlreadyInTransitionException {
-      super.addRegionsInTransition(region, currentAction);
+      return super.addRegionsInTransition(region, currentAction);
     }
   }
 

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java?rev=1465063&r1=1465062&r2=1465063&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java
(original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java
Fri Apr  5 17:42:30 2013
@@ -202,9 +202,9 @@ public class TestOpenRegionHandler {
       super(conf);
     }
     @Override
-    public void addRegionsInTransition(HRegionInfo region,
+    public boolean addRegionsInTransition(HRegionInfo region,
         String currentAction) throws RegionAlreadyInTransitionException {
-      super.addRegionsInTransition(region, currentAction);
+      return super.addRegionsInTransition(region, currentAction);
     }
   }
   



Mime
View raw message