From 1c903df5cfbfc659a49c88ecac51b3c05f3fd603 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 --- .../java/org/apache/hadoop/hbase/client/Admin.java | 171 ++++++++++++++++++--- .../org/apache/hadoop/hbase/client/AsyncAdmin.java | 66 +++++--- .../hadoop/hbase/client/AsyncHBaseAdmin.java | 82 +++++----- .../org/apache/hadoop/hbase/client/HBaseAdmin.java | 102 ++++++------ .../hadoop/hbase/client/RawAsyncHBaseAdmin.java | 74 ++++++--- .../hadoop/hbase/shaded/protobuf/ProtobufUtil.java | 13 ++ .../hadoop/hbase/client/TestInterfaceAlign.java | 91 +++++++++++ .../hbase/client/TestAsyncClusterAdminApi.java | 6 +- .../client/TestAsyncDecommissionAdminApi.java | 2 +- .../hbase/client/TestAsyncProcedureAdminApi.java | 2 +- .../hbase/client/TestAsyncRegionAdminApi.java | 38 ++--- .../TestAsyncReplicationAdminApiWithClusters.java | 8 +- .../hbase/client/TestAsyncTableAdminApi.java | 16 +- .../hadoop/hbase/client/TestAsyncToolAdminApi.java | 40 ++--- 14 files changed, 511 insertions(+), 200 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 d22d9e1..dc46798 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,44 @@ 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 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 + * @throws InterruptedException + */ + void compactRegionServer(ServerName serverName) throws IOException, InterruptedException; + + /** + * 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 + * @throws InterruptedException + */ + void majorCompactRegionServer(ServerName serverName) throws IOException, InterruptedException; /** * Move the region r to dest. @@ -1381,13 +1412,53 @@ public interface Admin extends Abortable, Closeable { ClusterStatus getClusterStatus(EnumSet