You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2019/03/30 12:53:07 UTC
[hbase] branch branch-2 updated: HBASE-22101
AsyncAdmin.isTableAvailable should not throw TableNotFoundException
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new b78c7a4 HBASE-22101 AsyncAdmin.isTableAvailable should not throw TableNotFoundException
b78c7a4 is described below
commit b78c7a4f0065ed6cc7c66a17419e19a408f6c695
Author: pingsutw <pi...@gmail.com>
AuthorDate: Wed Mar 27 03:17:01 2019 +0800
HBASE-22101 AsyncAdmin.isTableAvailable should not throw TableNotFoundException
Signed-off-by: zhangduo <zh...@apache.org>
---
.../java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java | 6 +++++-
.../org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java | 7 +++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
index 3663218..cd61dd5 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
@@ -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) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java
index 1750926..2c63033 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java
@@ -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());
+ }
}