From 93a104a018f8aa6d62715a36cdb97e4e30794099 Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Fri, 30 Sep 2011 04:03:33 +0000 Subject: [PATCH] HBASE-4412 No need to retry scan operation on the same server in case of RegionServerStoppedException (Ming Ma) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1177498 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ src/main/java/org/apache/hadoop/hbase/client/HTable.java | 4 +++- .../org/apache/hadoop/hbase/client/ScannerCallable.java | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 906efe1bcec..5de7bb2d0c6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -319,6 +319,8 @@ Release 0.92.0 - Unreleased HBASE-3130 [replication] ReplicationSource can't recover from session expired on remote clusters (Chris Trezzo via JD) HBASE-4212 TestMasterFailover fails occasionally (Gao Jinchao) + HBASE-4412 No need to retry scan operation on the same server in case of + RegionServerStoppedException (Ming Ma) TESTS HBASE-4450 test for number of blocks read: to serve as baseline for expected diff --git a/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/src/main/java/org/apache/hadoop/hbase/client/HTable.java index b5cf6396328..cc605912f98 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/HTable.java +++ b/src/main/java/org/apache/hadoop/hbase/client/HTable.java @@ -59,6 +59,7 @@ import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor; import org.apache.hadoop.hbase.client.coprocessor.Batch; import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; import org.apache.hadoop.hbase.ipc.ExecRPCInvoker; +import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException; import org.apache.hadoop.hbase.util.Addressing; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; @@ -1201,7 +1202,8 @@ public class HTable implements HTableInterface, Closeable { } } else { Throwable cause = e.getCause(); - if (cause == null || !(cause instanceof NotServingRegionException)) { + if (cause == null || (!(cause instanceof NotServingRegionException) + && !(cause instanceof RegionServerStoppedException))) { throw e; } } diff --git a/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java b/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java index 5ea38b444bd..20be3846fdb 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java +++ b/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java @@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.RemoteExceptionHandler; +import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException; import org.apache.hadoop.ipc.RemoteException; @@ -88,6 +89,11 @@ public class ScannerCallable extends ServerCallable { // 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 RegionServerStoppedException) { + // Throw a DNRE so that we break out of cycle of calling RSSE + // when what we need is to open scanner against new location. + // Attach RSSE to signal client that it needs to resetup scanner. + throw new DoNotRetryIOException("Reset scanner", ioe); } else { // The outer layers will retry throw ioe;