HBASE-6914 Scans/Gets/Mutations don't give a good error if the table is disabled.

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1393163 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
eclark 2012-10-02 20:39:09 +00:00
parent ac368c1ae8
commit e419fee3b4
2 changed files with 16 additions and 10 deletions

View File

@ -915,6 +915,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);
}

View File

@ -240,9 +240,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);
@ -288,23 +286,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);
@ -1014,9 +1011,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 {