Author: stack
Date: Sat Apr 24 17:03:22 2010
New Revision: 937644

URL: http://svn.apache.org/viewvc?rev=937644&view=rev
Log:
HBASE-2481 Client is not getting UnknownScannerExceptions; they are being eaten

Modified:
    hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
    
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HTable.java
    
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/ScannerCallable.java

Modified: hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt?rev=937644&r1=937643&r2=937644&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt Sat Apr 24 17:03:22 
2010
@@ -58,6 +58,8 @@ Release 0.20.4 - Thu Apr 15 16:29:44 PDT
                (Todd Lipcon via Stack)
    HBASE-2443  IPC client can throw NPE if socket creation fails
                (Todd Lipcon via Stack)
+   HBASE-2481  Client is not getting UnknownScannerExceptions; they are being
+               eaten (Jean-Daniel Cryans via Stack)
 
   IMPROVEMENTS
    HBASE-2180  Bad read performance from synchronizing hfile.fddatainputstream

Modified: 
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HTable.java
URL: 
http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HTable.java?rev=937644&r1=937643&r2=937644&view=diff
==============================================================================
--- 
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HTable.java
 (original)
+++ 
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HTable.java
 Sat Apr 24 17:03:22 2010
@@ -1984,6 +1984,16 @@ public class HTable {
               values = getConnection().getRegionServerWithRetries(callable);
             }
           } catch (DoNotRetryIOException e) {
+            long timeout = lastNext + scannerTimeout;
+            if (e instanceof UnknownScannerException &&
+                timeout < System.currentTimeMillis()) {
+              long elapsed = System.currentTimeMillis() - lastNext;
+              ScannerTimeoutException ex = new ScannerTimeoutException(
+                  elapsed + "ms passed since the last invocation, " +
+                      "timeout is currently set to " + scannerTimeout);
+              ex.initCause(e);
+              throw ex;
+            }
             Throwable cause = e.getCause();
             if (cause == null || !(cause instanceof 
NotServingRegionException)) {
               throw e;
@@ -1999,14 +2009,6 @@ public class HTable {
             // Clear region
             this.currentRegion = null;
             continue;
-          } catch (IOException e) {
-            if (e instanceof UnknownScannerException &&
-                lastNext + scannerTimeout < System.currentTimeMillis()) {
-              ScannerTimeoutException ex = new ScannerTimeoutException();
-              ex.initCause(e);
-              throw ex;
-            }
-            throw e;
           }
           lastNext = System.currentTimeMillis();
           if (values != null && values.length > 0) {

Modified: 
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/ScannerCallable.java
URL: 
http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/ScannerCallable.java?rev=937644&r1=937643&r2=937644&view=diff
==============================================================================
--- 
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/ScannerCallable.java
 (original)
+++ 
hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/ScannerCallable.java
 Sat Apr 24 17:03:22 2010
@@ -81,11 +81,15 @@ public class ScannerCallable extends Ser
         if (e instanceof RemoteException) {
           ioe = 
RemoteExceptionHandler.decodeRemoteException((RemoteException)e);
         }
-        if (ioe != null && ioe instanceof NotServingRegionException) {
+        if (ioe != null) {
+          if (ioe instanceof NotServingRegionException) {
           // Throw a DNRE so that we break out of cycle of calling NSRE
           // when what we need is to open scanner against new location.
           // Attach NSRE to signal client that it needs to resetup scanner.
           throw new DoNotRetryIOException("Reset scanner", ioe);
+          } else if (ioe instanceof DoNotRetryIOException) {
+            throw ioe;
+          }
         }
       }
       return rrs;


Reply via email to