hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject svn commit: r1393164 - in /hbase/branches/0.94/src: main/java/org/apache/hadoop/hbase/client/HConnectionManager.java test/java/org/apache/hadoop/hbase/client/TestAdmin.java
Date Tue, 02 Oct 2012 20:39:15 GMT
Author: eclark
Date: Tue Oct  2 20:39:14 2012
New Revision: 1393164

URL: http://svn.apache.org/viewvc?rev=1393164&view=rev
Log:
HBASE-6914 Scans/Gets/Mutations don't give a good error if the table is disabled.

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1393164&r1=1393163&r2=1393164&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Tue Oct  2 20:39:14 2012
@@ -813,6 +813,14 @@ public class HConnectionManager {
     public HRegionLocation relocateRegion(final byte [] tableName,
         final byte [] row)
     throws IOException{
+
+      // Since this is an explicit request not to use any caching, finding
+      // 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(Bytes.toString(tableName) + " is disabled.");
+      }
+
       return locateRegion(tableName, row, false, true);
     }
 

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java?rev=1393164&r1=1393163&r2=1393164&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java Tue Oct
 2 20:39:14 2012
@@ -236,9 +236,7 @@ public class TestAdmin {
     boolean ok = false;
     try {
       ht.get(get);
-    } catch (NotServingRegionException e) {
-      ok = true;
-    } catch (RetriesExhaustedException e) {
+    } catch (DoNotRetryIOException e) {
       ok = true;
     }
     assertTrue(ok);
@@ -284,23 +282,22 @@ public class TestAdmin {
     try {
       ht1.get(get);
       ht2.get(get);
-    } catch (NotServingRegionException e) {
-      ok = true;
-    } catch (RetriesExhaustedException e) {
+    } catch (DoNotRetryIOException e) {
       ok = true;
     }
+
     assertTrue(ok);
     this.admin.enableTables("testDisableAndEnableTable.*");
 
     // Test that tables are enabled
     try {
       ht1.get(get);
-    } catch (RetriesExhaustedException e) {
+    } catch (IOException e) {
       ok = false;
     }
     try {
       ht2.get(get);
-    } catch (RetriesExhaustedException e) {
+    } catch (IOException e) {
       ok = false;
     }
     assertTrue(ok);
@@ -1011,9 +1008,10 @@ public class TestAdmin {
     this.admin.disableTable(tableName);
     try {
       new HTable(TEST_UTIL.getConfiguration(), tableName);
-    } catch (org.apache.hadoop.hbase.client.RegionOfflineException e) {
-      // Expected
+    } catch (DoNotRetryIOException e) {
+      //expected
     }
+
     this.admin.addColumn(tableName, new HColumnDescriptor("col2"));
     this.admin.enableTable(tableName);
     try {



Mime
View raw message