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 331f2d119e3..01ebb66fd72 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
@@ -995,6 +995,19 @@ public interface Admin extends Abortable, Closeable {
}
}
+ /**
+ * Turn the compaction on or off. Disabling compactions will also interrupt any currently ongoing
+ * compactions. This state is ephemeral. The setting will be lost on restart. Compaction
+ * can also be enabled/disabled by modifying configuration hbase.regionserver.compaction.enabled
+ * in hbase-site.xml.
+ *
+ * @param switchState Set to true
to enable, false
to disable.
+ * @param serverNamesList list of region servers.
+ * @return Previous compaction states for region servers
+ */
+ Map compactionSwitch(boolean switchState, List serverNamesList)
+ throws IOException;
+
/**
* 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
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java
index 8141e74de75..0e47de82ba1 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java
@@ -1240,4 +1240,17 @@ public interface AsyncAdmin {
*/
CompletableFuture cloneTableSchema(final TableName tableName,
final TableName newTableName, final boolean preserveSplits);
+
+ /**
+ * Turn the compaction on or off. Disabling compactions will also interrupt any currently ongoing
+ * compactions. This state is ephemeral. The setting will be lost on restart. Compaction
+ * can also be enabled/disabled by modifying configuration hbase.regionserver.compaction.enabled
+ * in hbase-site.xml.
+ *
+ * @param switchState Set to true
to enable, false
to disable.
+ * @param serverNamesList list of region servers.
+ * @return Previous compaction states for region servers
+ */
+ CompletableFuture