HBASE-22101 AsyncAdmin.isTableAvailable should not throw TableNotFoundException
Signed-off-by: zhangduo <zhangduo@apache.org>
This commit is contained in:
parent
c6e4984928
commit
b78c7a4f00
|
@ -700,7 +700,11 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
|
|||
CompletableFuture<Boolean> future = new CompletableFuture<>();
|
||||
addListener(isTableEnabled(tableName), (enabled, error) -> {
|
||||
if (error != null) {
|
||||
future.completeExceptionally(error);
|
||||
if (error instanceof TableNotFoundException) {
|
||||
future.complete(false);
|
||||
} else {
|
||||
future.completeExceptionally(error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!enabled) {
|
||||
|
|
|
@ -453,4 +453,11 @@ public class TestAsyncTableAdminApi extends TestAsyncAdminBase {
|
|||
assertTrue(e.getCause() instanceof TableExistsException);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsTableAvailableWithInexistantTable() throws Exception {
|
||||
final TableName newTableName = TableName.valueOf(tableName.getNameAsString() + "_new");
|
||||
// test for inexistant table
|
||||
assertFalse(admin.isTableAvailable(newTableName).get());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue