From commits-return-84670-archive-asf-public=cust-asf.ponee.io@hbase.apache.org Sun Apr 7 13:06:06 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 60A2C18061A for ; Sun, 7 Apr 2019 15:06:06 +0200 (CEST) Received: (qmail 13943 invoked by uid 500); 7 Apr 2019 12:46:28 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 13933 invoked by uid 99); 7 Apr 2019 12:46:28 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Apr 2019 12:46:28 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 6F1908093A; Sun, 7 Apr 2019 13:06:05 +0000 (UTC) Date: Sun, 07 Apr 2019 13:06:05 +0000 To: "commits@hbase.apache.org" Subject: [hbase] branch master updated: HBASE-22178 Introduce a createTableAsync with TableDescriptor method in Admin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155464236479.27196.4185418164351809669@gitbox.apache.org> From: zhangduo@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: hbase X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: b3f62a7f592406ad58f7e8830a68c5897fe47b4a X-Git-Newrev: 11547b79f3e7fec26a7e18d00a991cc80a7c03ff X-Git-Rev: 11547b79f3e7fec26a7e18d00a991cc80a7c03ff X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/master by this push: new 11547b7 HBASE-22178 Introduce a createTableAsync with TableDescriptor method in Admin 11547b7 is described below commit 11547b79f3e7fec26a7e18d00a991cc80a7c03ff Author: zhangduo AuthorDate: Sat Apr 6 22:15:41 2019 +0800 HBASE-22178 Introduce a createTableAsync with TableDescriptor method in Admin --- .../java/org/apache/hadoop/hbase/client/Admin.java | 42 ++++++++++++++-------- .../org/apache/hadoop/hbase/client/HBaseAdmin.java | 10 +++--- .../hadoop/hbase/thrift2/client/ThriftAdmin.java | 5 +++ 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java index 0f59c23..bf52af9 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java @@ -196,7 +196,9 @@ public interface Admin extends Abortable, Closeable { * threads, the table may have been created between test-for-existence and attempt-at-creation). * @throws IOException if a remote or network exception occurs */ - void createTable(TableDescriptor desc) throws IOException; + default void createTable(TableDescriptor desc) throws IOException { + get(createTableAsync(desc), getSyncWaitTimeout(), TimeUnit.MILLISECONDS); + } /** * Creates a new table with the specified number of regions. The start key specified will become @@ -213,7 +215,6 @@ public interface Admin extends Abortable, Closeable { * @throws org.apache.hadoop.hbase.MasterNotRunningException if master is not running * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If concurrent * threads, the table may have been created between test-for-existence and attempt-at-creation). - * @throws IOException */ void createTable(TableDescriptor desc, byte[] startKey, byte[] endKey, int numRegions) throws IOException; @@ -237,22 +238,35 @@ public interface Admin extends Abortable, Closeable { } /** - * Creates a new table but does not block and wait for it to come online. - * You can use Future.get(long, TimeUnit) to wait on the operation to complete. - * It may throw ExecutionException if there was an error while executing the operation - * or TimeoutException in case the wait timeout was not long enough to allow the - * operation to complete. - * Throws IllegalArgumentException Bad table name, if the split keys - * are repeated and if the split key has empty byte array. - * + * Creates a new table but does not block and wait for it to come online. You can use + * Future.get(long, TimeUnit) to wait on the operation to complete. It may throw + * ExecutionException if there was an error while executing the operation or TimeoutException in + * case the wait timeout was not long enough to allow the operation to complete. + *

+ * Throws IllegalArgumentException Bad table name, if the split keys are repeated and if the split + * key has empty byte array. + * @param desc table descriptor for table + * @throws IOException if a remote or network exception occurs + * @return the result of the async creation. You can use Future.get(long, TimeUnit) to wait on the + * operation to complete. + */ + Future createTableAsync(TableDescriptor desc) throws IOException; + + /** + * Creates a new table but does not block and wait for it to come online. You can use + * Future.get(long, TimeUnit) to wait on the operation to complete. It may throw + * ExecutionException if there was an error while executing the operation or TimeoutException in + * case the wait timeout was not long enough to allow the operation to complete. + *

+ * Throws IllegalArgumentException Bad table name, if the split keys are repeated and if the split + * key has empty byte array. * @param desc table descriptor for table * @param splitKeys keys to check if the table has been created with all split keys * @throws IOException if a remote or network exception occurs - * @return the result of the async creation. You can use Future.get(long, TimeUnit) - * to wait on the operation to complete. + * @return the result of the async creation. You can use Future.get(long, TimeUnit) to wait on the + * operation to complete. */ - Future createTableAsync(TableDescriptor desc, byte[][] splitKeys) - throws IOException; + Future createTableAsync(TableDescriptor desc, byte[][] splitKeys) throws IOException; /** * Deletes a table. Synchronous operation. diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java index b364bbc..fd1cbc7 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java @@ -514,11 +514,6 @@ public class HBaseAdmin implements Admin { } @Override - public void createTable(TableDescriptor desc) throws IOException { - createTable(desc, null); - } - - @Override public void createTable(TableDescriptor desc, byte[] startKey, byte[] endKey, int numRegions) throws IOException { if (numRegions < 3) { @@ -3866,4 +3861,9 @@ public class HBaseAdmin implements Admin { public Future splitRegionAsync(byte[] regionName) throws IOException { return splitRegionAsync(regionName, null); } + + @Override + public Future createTableAsync(TableDescriptor desc) throws IOException { + return createTableAsync(desc, null); + } } diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java index 848e625..7ff1979 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java @@ -1032,6 +1032,11 @@ public class ThriftAdmin implements Admin { } @Override + public Future createTableAsync(TableDescriptor desc) { + throw new NotImplementedException("createTableAsync not supported in ThriftAdmin"); + } + + @Override public Future createTableAsync(TableDescriptor desc, byte[][] splitKeys) { throw new NotImplementedException("createTableAsync not supported in ThriftAdmin"); }