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:
parent
ac368c1ae8
commit
e419fee3b4
|
@ -915,6 +915,14 @@ public class HConnectionManager {
|
||||||
public HRegionLocation relocateRegion(final byte [] tableName,
|
public HRegionLocation relocateRegion(final byte [] tableName,
|
||||||
final byte [] row)
|
final byte [] row)
|
||||||
throws IOException{
|
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);
|
return locateRegion(tableName, row, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,9 +240,7 @@ public class TestAdmin {
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
try {
|
try {
|
||||||
ht.get(get);
|
ht.get(get);
|
||||||
} catch (NotServingRegionException e) {
|
} catch (DoNotRetryIOException e) {
|
||||||
ok = true;
|
|
||||||
} catch (RetriesExhaustedException e) {
|
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
assertTrue(ok);
|
assertTrue(ok);
|
||||||
|
@ -288,23 +286,22 @@ public class TestAdmin {
|
||||||
try {
|
try {
|
||||||
ht1.get(get);
|
ht1.get(get);
|
||||||
ht2.get(get);
|
ht2.get(get);
|
||||||
} catch (NotServingRegionException e) {
|
} catch (DoNotRetryIOException e) {
|
||||||
ok = true;
|
|
||||||
} catch (RetriesExhaustedException e) {
|
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(ok);
|
assertTrue(ok);
|
||||||
this.admin.enableTables("testDisableAndEnableTable.*");
|
this.admin.enableTables("testDisableAndEnableTable.*");
|
||||||
|
|
||||||
// Test that tables are enabled
|
// Test that tables are enabled
|
||||||
try {
|
try {
|
||||||
ht1.get(get);
|
ht1.get(get);
|
||||||
} catch (RetriesExhaustedException e) {
|
} catch (IOException e) {
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ht2.get(get);
|
ht2.get(get);
|
||||||
} catch (RetriesExhaustedException e) {
|
} catch (IOException e) {
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
assertTrue(ok);
|
assertTrue(ok);
|
||||||
|
@ -1014,9 +1011,10 @@ public class TestAdmin {
|
||||||
this.admin.disableTable(tableName);
|
this.admin.disableTable(tableName);
|
||||||
try {
|
try {
|
||||||
new HTable(TEST_UTIL.getConfiguration(), tableName);
|
new HTable(TEST_UTIL.getConfiguration(), tableName);
|
||||||
} catch (org.apache.hadoop.hbase.client.RegionOfflineException e) {
|
} catch (DoNotRetryIOException e) {
|
||||||
// Expected
|
//expected
|
||||||
}
|
}
|
||||||
|
|
||||||
this.admin.addColumn(tableName, new HColumnDescriptor("col2"));
|
this.admin.addColumn(tableName, new HColumnDescriptor("col2"));
|
||||||
this.admin.enableTable(tableName);
|
this.admin.enableTable(tableName);
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue