From 58fb5e9917ccde2abe548f593b25ed8516967024 Mon Sep 17 00:00:00 2001 From: Elliott Neil Clark Date: Fri, 1 Nov 2013 14:57:20 -0700 Subject: [PATCH] HBASE-9859 Canary Shouldn't go off if the table being read from is disabled --- .../java/org/apache/hadoop/hbase/client/HConnectionManager.java | 3 ++- .../src/main/java/org/apache/hadoop/hbase/tool/Canary.java | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java index 858da24..30805f0 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java @@ -60,6 +60,7 @@ import org.apache.hadoop.hbase.RegionTooBusyException; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.Stoppable; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.TableNotEnabledException; import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor; @@ -1026,7 +1027,7 @@ public class HConnectionManager { // disabled tables should not be desirable. This will ensure that an exception is thrown when // the first time a disabled table is interacted with. if (isTableDisabled(tableName)) { - throw new DoNotRetryIOException(tableName.getNameAsString() + " is disabled."); + throw new TableNotEnabledException(tableName.getNameAsString() + " is disabled."); } return locateRegion(tableName, row, false, true); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java index 8c7ee14..9daf9b7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java @@ -34,11 +34,13 @@ import org.apache.commons.lang.time.StopWatch; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.TableNotEnabledException; import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.HBaseAdmin; @@ -616,6 +618,13 @@ public final class Canary implements Tool { stopWatch.stop(); } this.getSink().publishReadTiming(tableName, serverName, stopWatch.getTime()); + } catch (TableNotFoundException tnfe) { + // This is ignored because it doesn't imply that the regionserver is dead + } catch (TableNotEnabledException tnee) { + // This is considered a success since we got a response. + }catch (DoNotRetryIOException dnrioe) { + this.getSink().publishReadFailure(tableName, serverName); + LOG.error(dnrioe); } catch (IOException e) { this.getSink().publishReadFailure(tableName, serverName); LOG.error(e); -- 1.8.3.4 (Apple Git-47)