From 52273aa8f3221e11489004bacba4f4b6eb05f5c3 Mon Sep 17 00:00:00 2001 From: Guanghao Zhang Date: Sat, 14 Oct 2017 17:41:15 +0800 Subject: [PATCH] HBASE-18911 Unify Admin and AsyncAdmin's methods name --- .../org/apache/hadoop/hbase/client/Admin.java | 185 +++++++++++++++--- .../hadoop/hbase/client/AsyncAdmin.java | 66 +++++-- .../hadoop/hbase/client/AsyncHBaseAdmin.java | 82 ++++---- .../hadoop/hbase/client/HBaseAdmin.java | 97 +++++---- .../hbase/client/RawAsyncHBaseAdmin.java | 76 ++++--- .../hbase/shaded/protobuf/ProtobufUtil.java | 15 ++ .../hbase/client/TestInterfaceAlign.java | 91 +++++++++ .../client/TestAsyncClusterAdminApi.java | 6 +- .../client/TestAsyncDecommissionAdminApi.java | 2 +- .../client/TestAsyncProcedureAdminApi.java | 2 +- .../hbase/client/TestAsyncRegionAdminApi.java | 38 ++-- ...tAsyncReplicationAdminApiWithClusters.java | 8 +- .../hbase/client/TestAsyncTableAdminApi.java | 16 +- .../hbase/client/TestAsyncToolAdminApi.java | 40 ++-- 14 files changed, 520 insertions(+), 204 deletions(-) create mode 100644 hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestInterfaceAlign.java 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 d22d9e19fb1..fd02a487764 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 @@ -26,6 +26,7 @@ import java.util.EnumSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; import java.util.concurrent.Future; import java.util.regex.Pattern; @@ -58,6 +59,7 @@ import org.apache.hadoop.hbase.snapshot.HBaseSnapshotException; import org.apache.hadoop.hbase.snapshot.RestoreSnapshotException; import org.apache.hadoop.hbase.snapshot.SnapshotCreationException; import org.apache.hadoop.hbase.snapshot.UnknownSnapshotException; +import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; /** @@ -916,15 +918,43 @@ public interface Admin extends Abortable, Closeable { /** * Compact all regions on the region server. Asynchronous operation in that this method requests - * that a Compaction run and then it returns. It does not wait on the completion of Compaction - * (it can take a while). + * that a Compaction run and then it returns. It does not wait on the completion of Compaction (it + * can take a while). * @param sn the region server name * @param major if it's major compaction - * @throws IOException + * @throws IOException if a remote or network exception occurs * @throws InterruptedException + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use + * {@link #compactRegionServer(ServerName)} or + * {@link #majorCompactRegionServer(ServerName)}. */ - void compactRegionServer(ServerName sn, boolean major) - throws IOException, InterruptedException; + @Deprecated + default void compactRegionServer(ServerName sn, boolean major) throws IOException, + InterruptedException { + if (major) { + majorCompactRegionServer(sn); + } else { + compactRegionServer(sn); + } + } + + /** + * Compact all regions on the region server. Asynchronous operation in that this method requests + * that a Compaction run and then it returns. It does not wait on the completion of Compaction (it + * can take a while). + * @param serverName the region server name + * @throws IOException if a remote or network exception occurs + */ + void compactRegionServer(ServerName serverName) throws IOException; + + /** + * Major compact all regions on the region server. Asynchronous operation in that this method + * requests that a Compaction run and then it returns. It does not wait on the completion of + * Compaction (it can take a while). + * @param serverName the region server name + * @throws IOException if a remote or network exception occurs + */ + void majorCompactRegionServer(ServerName serverName) throws IOException; /** * Move the region r to dest. @@ -1380,14 +1410,75 @@ public interface Admin extends Abortable, Closeable { */ ClusterStatus getClusterStatus(EnumSet