hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1468219 - in /hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client: HConnection.java HConnectionManager.java ServerCallable.java
Date Mon, 15 Apr 2013 20:42:07 GMT
Author: larsh
Date: Mon Apr 15 20:42:07 2013
New Revision: 1468219

URL: http://svn.apache.org/r1468219
Log:
HBASE-8285 HBaseClient never recovers for single HTable.get() calls with no retries when regions
move (Varun Sharma)

Modified:
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java?rev=1468219&r1=1468218&r2=1468219&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
(original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
Mon Apr 15 20:42:07 2013
@@ -163,6 +163,12 @@ public interface HConnection extends Abo
   public void clearRegionCache(final byte [] tableName);
 
   /**
+   * Deletes cached locations for the specific region.
+   * @param location The location object for the region, to be purged from cache.
+   */
+  public void deleteCachedRegionLocation(final HRegionLocation location);
+
+  /**
    * Find the location of the region of <i>tableName</i> that <i>row</i>
    * lives in, ignoring any value that might be in the cache.
    * @param tableName name of the table <i>row</i> is in

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1468219&r1=1468218&r2=1468219&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
(original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Mon Apr 15 20:42:07 2013
@@ -1888,6 +1888,28 @@ public class HConnectionManager {
       }
     }
 
+    @Override
+    public void deleteCachedRegionLocation(final HRegionLocation location) {
+      if (location == null) {
+        return;
+      }
+      synchronized (this.cachedRegionLocations) {
+        byte[] tableName = location.getRegionInfo().getTableName();
+        Map<byte[], HRegionLocation> tableLocations = getTableLocations(tableName);
+        if (!tableLocations.isEmpty()) {
+          // Delete if there's something in the cache for this region.
+          HRegionLocation removedLocation =
+          tableLocations.remove(location.getRegionInfo().getStartKey());
+          if (LOG.isDebugEnabled() && removedLocation != null) {
+            LOG.debug("Removed " +
+                location.getRegionInfo().getRegionNameAsString() +
+                " for tableName=" + Bytes.toString(tableName) +
+                " from cache");
+          }
+        }
+      }
+    }
+
     /**
      * Update the location with the new value (if the exception is a RegionMovedException)
      * or delete it from the cache.

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java?rev=1468219&r1=1468218&r2=1468219&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java
(original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java
Mon Apr 15 20:42:07 2013
@@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.exceptions.DoNotRetryIOException;
+import org.apache.hadoop.hbase.exceptions.NotServingRegionException;
 import org.apache.hadoop.hbase.ipc.HBaseClientRPC;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
@@ -181,6 +182,10 @@ public abstract class ServerCallable<T> 
           // map to that slow/dead server; otherwise, let cache miss and ask
           // .META. again to find the new location
           getConnection().clearCaches(location.getServerName());
+        } else if (t instanceof NotServingRegionException && numRetries == 1) {
+          // Purge cache entries for this specific region from META cache
+          // since we don't call connect(true) when number of retries is 1.
+          getConnection().deleteCachedRegionLocation(location);
         }
 
         RetriesExhaustedException.ThrowableWithExtraContext qt =



Mime
View raw message