hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1541821 - /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Date Thu, 14 Nov 2013 05:01:59 GMT
Author: stack
Date: Thu Nov 14 05:01:59 2013
New Revision: 1541821

URL: http://svn.apache.org/r1541821
Log:
HBASE-9710 Use the region name, not the encoded name, when region is not on current server

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1541821&r1=1541820&r2=1541821&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Thu Nov 14 05:01:59 2013
@@ -2563,10 +2563,15 @@ public class HRegionServer implements Cl
   protected HRegion getRegion(final byte[] regionName)
       throws NotServingRegionException {
     String encodedRegionName = HRegionInfo.encodeRegionName(regionName);
-    return getRegionByEncodedName(encodedRegionName);
+    return getRegionByEncodedName(regionName, encodedRegionName);
   }
 
   protected HRegion getRegionByEncodedName(String encodedRegionName)
+      throws NotServingRegionException {
+    return getRegionByEncodedName(null, encodedRegionName);
+  }
+
+  protected HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
     throws NotServingRegionException {
     HRegion region = this.onlineRegions.get(encodedRegionName);
     if (region == null) {
@@ -2575,10 +2580,12 @@ public class HRegionServer implements Cl
         throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
       }
       Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
+      String regionNameStr = regionName == null?
+        encodedRegionName: Bytes.toStringBinary(regionName);
       if (isOpening != null && isOpening.booleanValue()) {
-        throw new RegionOpeningException("Region is being opened: " + encodedRegionName);
+        throw new RegionOpeningException("Region " + regionNameStr + " is opening");
       }
-      throw new NotServingRegionException("Region is not online: " + encodedRegionName);
+      throw new NotServingRegionException("Region " + regionNameStr + " is not online");
     }
     return region;
   }
@@ -3943,7 +3950,7 @@ public class HRegionServer implements Cl
    */
   protected HRegion getRegion(
       final RegionSpecifier regionSpecifier) throws IOException {
-    return getRegionByEncodedName(
+    return getRegionByEncodedName(regionSpecifier.getValue().toByteArray(),
         ProtobufUtil.getRegionEncodedName(regionSpecifier));
   }
 



Mime
View raw message