From c6116e556bcc0913e39e5385db3271077e8fc441 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 12 Sep 2017 18:36:17 -0700 Subject: [PATCH] HBASE-14998 Unify synchronous and asynchronous methods in Admin and cleanup This is based on patch sent me by Balazs Meszaros. The good stuff in here is from him. This patch does less than his ambition. It changes Admin class only. Can work on making AsyncAdmin cohere in a follow-on. * Deprecates getAlterStatus. Everywhere else we talk of 'modify' rather 'alter' and should use Future returned from async instead. * isTableAvailable(TableName, byte [][]) has been deprecated to be removed; use the overrie instead. This is a weird method. * Changed listTableDescriptor to getDescriptor. * Renamed other like methods to have same pattern (deprecating the old): balancer => balance setBalancerRunning => balancerSwitch setNormalizerRunning => normalizerSwitch enableCatalogJanitor => catalogJanitorSwitch setCleanerChoreRunning => cleanerChoreSwitch setSplitOrMergeEnabled => splitOrMergeEnabledSwitch * Renamed (with deprecation of old) runCatalogScan => runCatalogJanitor. * Reviewed generated javadoc and made some edits; purged reference to hbase issues from our API, fixed param names, etc. * Made all the enable services methods have same pattern. * Renamed takeSnapshotAsync as snapshotAsync (with deprecation of old) * Renamed execProcedureWithRet as execProcedureWithReturn (with deprecation) --- .../hadoop/hbase/backup/util/RestoreTool.java | 2 +- .../java/org/apache/hadoop/hbase/client/Admin.java | 803 +++++++++++++-------- .../org/apache/hadoop/hbase/client/HBaseAdmin.java | 26 +- .../hbase/IntegrationTestDDLMasterFailover.java | 14 +- .../apache/hadoop/hbase/chaos/actions/Action.java | 2 +- .../hbase/chaos/actions/RemoveColumnAction.java | 2 +- .../apache/hadoop/hbase/mapreduce/CopyTable.java | 2 +- .../hadoop/hbase/mob/ExpiredMobFileCleaner.java | 2 +- .../TestHColumnDescriptorDefaultVersions.java | 2 +- .../hbase/client/TestReplicaWithCluster.java | 6 +- 10 files changed, 522 insertions(+), 339 deletions(-) diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java index c2f1939b7e..ca0d02669f 100644 --- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java +++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java @@ -177,7 +177,7 @@ public class RestoreTool { LOG.debug("Found descriptor " + tableDescriptor + " through " + incrBackupId); TableName newTableName = newTableNames[i]; - TableDescriptor newTableDescriptor = admin.listTableDescriptor(newTableName); + TableDescriptor newTableDescriptor = admin.getDescriptor(newTableName); List families = Arrays.asList(tableDescriptor.getColumnFamilies()); List existingFamilies = Arrays.asList(newTableDescriptor.getColumnFamilies()); 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 19290f0e2a..0a82a6b2f3 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 @@ -60,10 +60,10 @@ import org.apache.hadoop.hbase.snapshot.UnknownSnapshotException; import org.apache.hadoop.hbase.util.Pair; /** - * The administrative API for HBase. Obtain an instance from an {@link Connection#getAdmin()} and - * call {@link #close()} afterwards. - *

Admin can be used to create, drop, list, enable and disable tables, add and drop table - * column families and other administrative operations. + * The administrative API for HBase. Obtain an instance from {@link Connection#getAdmin()} and + * call {@link #close()} when done. + *

Admin can be used to create, drop, list, enable and disable and otherwise modify tables, + * as well as perform other administrative operations. * * @see ConnectionFactory * @see Connection @@ -87,18 +87,19 @@ public interface Admin extends Abortable, Closeable { /** * @param tableName Table to check. - * @return True if table exists already. + * @return true if table exists already. * @throws IOException */ - boolean tableExists(final TableName tableName) throws IOException; + boolean tableExists(TableName tableName) throws IOException; /** * List all the userspace tables. * - * @return - returns an array of read-only HTableDescriptors + * @return an array of read-only HTableDescriptors * @throws IOException if a remote or network exception occurs * @deprecated since 2.0 version and will be removed in 3.0 version. - * use {@link #listTableDescriptors()} + * Use {@link #listTableDescriptors()}. + * @see #listTableDescriptors() */ @Deprecated HTableDescriptor[] listTables() throws IOException; @@ -106,29 +107,30 @@ public interface Admin extends Abortable, Closeable { /** * List all the userspace tables. * - * @return - returns a list of TableDescriptors + * @return a list of TableDescriptors * @throws IOException if a remote or network exception occurs */ List listTableDescriptors() throws IOException; /** - * List all the userspace tables matching the given pattern. + * List all the userspace tables that match the given pattern. * * @param pattern The compiled regular expression to match against - * @return - returns an array of read-only HTableDescriptors + * @return an array of read-only HTableDescriptors * @throws IOException if a remote or network exception occurs * @see #listTables() * @deprecated since 2.0 version and will be removed in 3.0 version. - * use {@link #listTableDescriptors(java.util.regex.Pattern)} + * Use {@link #listTableDescriptors(java.util.regex.Pattern)}. + * @see #listTableDescriptors(Pattern) */ @Deprecated HTableDescriptor[] listTables(Pattern pattern) throws IOException; /** - * List all the userspace tables matching the given pattern. + * List all the userspace tables that match the given pattern. * * @param pattern The compiled regular expression to match against - * @return - returns a list of TableDescriptors + * @return a list of TableDescriptors * @throws IOException if a remote or network exception occurs * @see #listTables() */ @@ -138,11 +140,11 @@ public interface Admin extends Abortable, Closeable { * List all the userspace tables matching the given regular expression. * * @param regex The regular expression to match against - * @return - returns an array of read-only HTableDescriptors + * @return a list of read-only HTableDescriptors * @throws IOException if a remote or network exception occurs - * @see #listTables(java.util.regex.Pattern) + * @see #listTableDescriptors(java.lang.String) * @deprecated since 2.0 version and will be removed in 3.0 version. - * use {@link #listTableDescriptors(java.lang.String)} + * Use {@link #listTableDescriptors(java.lang.String)}. */ @Deprecated HTableDescriptor[] listTables(String regex) throws IOException; @@ -150,8 +152,8 @@ public interface Admin extends Abortable, Closeable { /** * List all the userspace tables matching the given regular expression. * - * @param regex The regular expression to match against - * @return - returns a list of TableDescriptors + * @param regex The regular expression to match against. + * @return a list of TableDescriptors * @throws IOException if a remote or network exception occurs * @see #listTables(java.util.regex.Pattern) */ @@ -161,12 +163,13 @@ public interface Admin extends Abortable, Closeable { * List all the tables matching the given pattern. * * @param pattern The compiled regular expression to match against - * @param includeSysTables False to match only against userspace tables - * @return - returns an array of read-only HTableDescriptors + * @param includeSysTables false to match only against userspace tables + * @return an array of read-only HTableDescriptors * @throws IOException if a remote or network exception occurs * @see #listTables() * @deprecated since 2.0 version and will be removed in 3.0 version. - * use {@link #listTableDescriptors(java.util.regex.Pattern, boolean)} + * Use {@link #listTableDescriptors(java.util.regex.Pattern, boolean)}. + * @see #listTableDescriptors(java.util.regex.Pattern, boolean) */ @Deprecated HTableDescriptor[] listTables(Pattern pattern, boolean includeSysTables) @@ -176,8 +179,8 @@ public interface Admin extends Abortable, Closeable { * List all the tables matching the given pattern. * * @param pattern The compiled regular expression to match against - * @param includeSysTables False to match only against userspace tables - * @return - returns a list of TableDescriptors + * @param includeSysTables false to match only against userspace tables + * @return a list of TableDescriptors * @throws IOException if a remote or network exception occurs * @see #listTables() */ @@ -188,12 +191,12 @@ public interface Admin extends Abortable, Closeable { * List all the tables matching the given pattern. * * @param regex The regular expression to match against - * @param includeSysTables False to match only against userspace tables - * @return - returns an array of read-only HTableDescriptors + * @param includeSysTables false to match only against userspace tables + * @return an array of read-only HTableDescriptors * @throws IOException if a remote or network exception occurs * @see #listTables(java.util.regex.Pattern, boolean) * @deprecated since 2.0 version and will be removed in 3.0 version. - * use {@link #listTableDescriptors(java.lang.String, boolean)} + * Use {@link #listTableDescriptors(java.lang.String, boolean)}. */ @Deprecated HTableDescriptor[] listTables(String regex, boolean includeSysTables) @@ -203,8 +206,8 @@ public interface Admin extends Abortable, Closeable { * List all the tables matching the given pattern. * * @param regex The regular expression to match against - * @param includeSysTables False to match only against userspace tables - * @return - returns a list of TableDescriptors + * @param includeSysTables false to match only against userspace tables + * @return a list of TableDescriptors * @throws IOException if a remote or network exception occurs * @see #listTables(java.util.regex.Pattern, boolean) */ @@ -222,7 +225,7 @@ public interface Admin extends Abortable, Closeable { /** * List all of the names of userspace tables. * @param pattern The regular expression to match against - * @return TableName[] table names + * @return array of table names * @throws IOException if a remote or network exception occurs */ TableName[] listTableNames(Pattern pattern) throws IOException; @@ -238,46 +241,46 @@ public interface Admin extends Abortable, Closeable { /** * List all of the names of userspace tables. * @param pattern The regular expression to match against - * @param includeSysTables False to match only against userspace tables + * @param includeSysTables false to match only against userspace tables * @return TableName[] table names * @throws IOException if a remote or network exception occurs */ - TableName[] listTableNames(final Pattern pattern, final boolean includeSysTables) + TableName[] listTableNames(Pattern pattern, boolean includeSysTables) throws IOException; /** * List all of the names of userspace tables. * @param regex The regular expression to match against - * @param includeSysTables False to match only against userspace tables + * @param includeSysTables false to match only against userspace tables * @return TableName[] table names * @throws IOException if a remote or network exception occurs */ - TableName[] listTableNames(final String regex, final boolean includeSysTables) + TableName[] listTableNames(String regex, boolean includeSysTables) throws IOException; /** - * Method for getting the tableDescriptor + * Get a table descriptor. * * @param tableName as a {@link TableName} * @return the read-only tableDescriptor * @throws org.apache.hadoop.hbase.TableNotFoundException * @throws IOException if a remote or network exception occurs * @deprecated since 2.0 version and will be removed in 3.0 version. - * use {@link #listTableDescriptor(TableName)} + * Use {@link #getDescriptor(TableName)}. */ @Deprecated - HTableDescriptor getTableDescriptor(final TableName tableName) + HTableDescriptor getTableDescriptor(TableName tableName) throws TableNotFoundException, IOException; /** - * Method for getting the tableDescriptor + * Get a table descriptor. * * @param tableName as a {@link TableName} * @return the tableDescriptor * @throws org.apache.hadoop.hbase.TableNotFoundException * @throws IOException if a remote or network exception occurs */ - TableDescriptor listTableDescriptor(final TableName tableName) + TableDescriptor getDescriptor(TableName tableName) throws TableNotFoundException, IOException; /** @@ -326,7 +329,7 @@ public interface Admin extends Abortable, Closeable { * threads, the table may have been created between test-for-existence and attempt-at-creation). * @throws IOException */ - void createTable(final TableDescriptor desc, byte[][] splitKeys) throws IOException; + void createTable(TableDescriptor desc, byte[][] splitKeys) throws IOException; /** * Creates a new table but does not block and wait for it to come online. @@ -343,7 +346,7 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async creation. You can use Future.get(long, TimeUnit) * to wait on the operation to complete. */ - Future createTableAsync(final TableDescriptor desc, final byte[][] splitKeys) + Future createTableAsync(TableDescriptor desc, byte[][] splitKeys) throws IOException; /** @@ -352,10 +355,10 @@ public interface Admin extends Abortable, Closeable { * @param tableName name of table to delete * @throws IOException if a remote or network exception occurs */ - void deleteTable(final TableName tableName) throws IOException; + void deleteTable(TableName tableName) throws IOException; /** - * Deletes the table but does not block and wait for it be completely removed. + * Deletes the table but does not block and wait for it to be completely removed. * 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 @@ -411,24 +414,24 @@ public interface Admin extends Abortable, Closeable { * Synchronous operation. * * @param tableName name of table to truncate - * @param preserveSplits True if the splits should be preserved + * @param preserveSplits true if the splits should be preserved * @throws IOException if a remote or network exception occurs */ - public void truncateTable(final TableName tableName, final boolean preserveSplits) + void truncateTable(TableName tableName, boolean preserveSplits) throws IOException; /** - * Truncate the table but does not block and wait for it be completely enabled. You can use + * Truncate the table but does not block and wait for it to be completely enabled. 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. * @param tableName name of table to delete - * @param preserveSplits true if the splits should be preserved + * @param preserveSplits true if the splits should be preserved * @throws IOException if a remote or network exception occurs * @return the result of the async truncate. You can use Future.get(long, TimeUnit) to wait on the * operation to complete. */ - Future truncateTableAsync(final TableName tableName, final boolean preserveSplits) + Future truncateTableAsync(TableName tableName, boolean preserveSplits) throws IOException; /** @@ -444,10 +447,10 @@ public interface Admin extends Abortable, Closeable { * @see #disableTable(org.apache.hadoop.hbase.TableName) * @see #enableTableAsync(org.apache.hadoop.hbase.TableName) */ - void enableTable(final TableName tableName) throws IOException; + void enableTable(TableName tableName) throws IOException; /** - * Enable the table but does not block and wait for it be completely enabled. + * Enable the table but does not block and wait for it to be completely enabled. * 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 @@ -458,7 +461,7 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async enable. You can use Future.get(long, TimeUnit) * to wait on the operation to complete. */ - Future enableTableAsync(final TableName tableName) throws IOException; + Future enableTableAsync(TableName tableName) throws IOException; /** * Enable tables matching the passed in pattern and wait on completion. Warning: Use this method @@ -498,7 +501,7 @@ public interface Admin extends Abortable, Closeable { HTableDescriptor[] enableTables(Pattern pattern) throws IOException; /** - * Disable the table but does not block and wait for it be completely disabled. + * Disable the table but does not block and wait for it to be completely disabled. * 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 @@ -509,7 +512,7 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async disable. You can use Future.get(long, TimeUnit) * to wait on the operation to complete. */ - Future disableTableAsync(final TableName tableName) throws IOException; + Future disableTableAsync(TableName tableName) throws IOException; /** * Disable table and wait on completion. May timeout eventually. Use {@link @@ -521,7 +524,7 @@ public interface Admin extends Abortable, Closeable { * @throws IOException There could be couple types of IOException TableNotFoundException means the * table doesn't exist. TableNotEnabledException means the table isn't in enabled state. */ - void disableTable(final TableName tableName) throws IOException; + void disableTable(TableName tableName) throws IOException; /** * Disable tables matching the passed in pattern and wait on completion. Warning: Use this method @@ -563,21 +566,21 @@ public interface Admin extends Abortable, Closeable { /** * @param tableName name of table to check - * @return true if table is on-line + * @return true if table is on-line * @throws IOException if a remote or network exception occurs */ boolean isTableEnabled(TableName tableName) throws IOException; /** * @param tableName name of table to check - * @return true if table is off-line + * @return true if table is off-line * @throws IOException if a remote or network exception occurs */ boolean isTableDisabled(TableName tableName) throws IOException; /** * @param tableName name of table to check - * @return true if all regions of the table are available + * @return true if all regions of the table are available * @throws IOException if a remote or network exception occurs */ boolean isTableAvailable(TableName tableName) throws IOException; @@ -585,64 +588,72 @@ public interface Admin extends Abortable, Closeable { /** * Use this api to check if the table has been created with the specified number of splitkeys * which was used while creating the given table. Note : If this api is used after a table's - * region gets splitted, the api may return false. + * region gets splitted, the api may return false. * * @param tableName name of table to check * @param splitKeys keys to check if the table has been created with all split keys * @throws IOException if a remote or network excpetion occurs + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #isTableAvailable(TableName)} */ + @Deprecated boolean isTableAvailable(TableName tableName, byte[][] splitKeys) throws IOException; /** - * Get the status of alter command - indicates how many regions have received the updated schema - * Asynchronous operation. + * Get the status of an alter (a.k.a modify) command - indicates how + * many regions have received the updated schema Asynchronous operation. * * @param tableName TableName instance * @return Pair indicating the number of regions updated Pair.getFirst() is the regions that are * yet to be updated Pair.getSecond() is the total number of regions of the table * @throws IOException if a remote or network exception occurs + * @deprecated Since 2.0.0. Will be removed in 3.0.0. No longer needed now you get a Future + * on an operation. */ - Pair getAlterStatus(final TableName tableName) throws IOException; + @Deprecated + Pair getAlterStatus(TableName tableName) throws IOException; /** - * Get the status of alter command - indicates how many regions have received the updated schema - * Asynchronous operation. + * Get the status of alter (a.k.a modify) command - indicates how many + * regions have received the updated schema Asynchronous operation. * * @param tableName name of the table to get the status of * @return Pair indicating the number of regions updated Pair.getFirst() is the regions that are * yet to be updated Pair.getSecond() is the total number of regions of the table * @throws IOException if a remote or network exception occurs - * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #getAlterStatus(TableName)} - * instead. + * @deprecated Since 2.0.0. Will be removed in 3.0.0. No longer needed now you get a Future + * on an operation. */ @Deprecated - Pair getAlterStatus(final byte[] tableName) throws IOException; + Pair getAlterStatus(byte[] tableName) throws IOException; /** - * Add a column family to an existing table. Asynchronous operation. + * Add a column family to an existing table. Synchronous operation. + * Use {@link #addColumnFamilyAsync(TableName, ColumnFamilyDescriptor)} instead because it + * returns a {@link Future} from which you can learn whether success or failure. * * @param tableName name of the table to add column family to * @param columnFamily column family descriptor of column family to be added * @throws IOException if a remote or network exception occurs * @deprecated As of release 2.0.0. - * (HBASE-1989). * This will be removed in HBase 3.0.0. * Use {@link #addColumnFamily(TableName, ColumnFamilyDescriptor)}. */ @Deprecated - default void addColumn(final TableName tableName, final ColumnFamilyDescriptor columnFamily) + default void addColumn(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException { addColumnFamily(tableName, columnFamily); } /** - * Add a column family to an existing table. + * Add a column family to an existing table. Synchronous operation. + * Use {@link #addColumnFamilyAsync(TableName, ColumnFamilyDescriptor)} instead because it + * returns a {@link Future} from which you can learn whether success or failure. * * @param tableName name of the table to add column family to * @param columnFamily column family descriptor of column family to be added * @throws IOException if a remote or network exception occurs */ - void addColumnFamily(final TableName tableName, final ColumnFamilyDescriptor columnFamily) + void addColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException; /** @@ -658,31 +669,33 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async add column family. You can use Future.get(long, TimeUnit) to * wait on the operation to complete. */ - Future addColumnFamilyAsync(final TableName tableName, final ColumnFamilyDescriptor columnFamily) + Future addColumnFamilyAsync(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException; /** - * Delete a column family from a table. Asynchronous operation. + * Delete a column family from a table. Synchronous operation. + * Use {@link #deleteColumnFamily(TableName, byte[])} instead because it + * returns a {@link Future} from which you can learn whether success or failure. * * @param tableName name of table * @param columnFamily name of column family to be deleted * @throws IOException if a remote or network exception occurs * @deprecated As of release 2.0.0. - * (HBASE-1989). * This will be removed in HBase 3.0.0. * Use {@link #deleteColumnFamily(TableName, byte[])}}. */ @Deprecated - void deleteColumn(final TableName tableName, final byte[] columnFamily) throws IOException; + void deleteColumn(TableName tableName, byte[] columnFamily) throws IOException; /** - * Delete a column family from a table. Asynchronous operation. - * + * Delete a column family from a table. Synchronous operation. + * Use {@link #deleteColumnFamily(TableName, byte[])} instead because it + * returns a {@link Future} from which you can learn whether success or failure. * @param tableName name of table * @param columnFamily name of column family to be deleted * @throws IOException if a remote or network exception occurs */ - void deleteColumnFamily(final TableName tableName, final byte[] columnFamily) throws IOException; + void deleteColumnFamily(TableName tableName, byte[] columnFamily) throws IOException; /** * Delete a column family from a table. Asynchronous operation. @@ -697,34 +710,35 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async delete column family. You can use Future.get(long, TimeUnit) to * wait on the operation to complete. */ - Future deleteColumnFamilyAsync(final TableName tableName, final byte[] columnFamily) + Future deleteColumnFamilyAsync(TableName tableName, byte[] columnFamily) throws IOException; /** - * Modify an existing column family on a table. - * + * Modify an existing column family on a table. Synchronous operation. + * Use {@link #modifyColumnFamilyAsync(TableName, ColumnFamilyDescriptor)} instead because it + * returns a {@link Future} from which you can learn whether success or failure. * @param tableName name of table * @param columnFamily new column family descriptor to use * @throws IOException if a remote or network exception occurs * @deprecated As of release 2.0.0. - * (HBASE-1989). * This will be removed in HBase 3.0.0. * Use {@link #modifyColumnFamily(TableName, ColumnFamilyDescriptor)}. */ @Deprecated - default void modifyColumn(final TableName tableName, final ColumnFamilyDescriptor columnFamily) + default void modifyColumn(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException { modifyColumnFamily(tableName, columnFamily); } /** - * Modify an existing column family on a table. - * + * Modify an existing column family on a table. Synchronous operation. + * Use {@link #modifyColumnFamilyAsync(TableName, ColumnFamilyDescriptor)} instead because it + * returns a {@link Future} from which you can learn whether success or failure. * @param tableName name of table * @param columnFamily new column family descriptor to use * @throws IOException if a remote or network exception occurs */ - void modifyColumnFamily(final TableName tableName, final ColumnFamilyDescriptor columnFamily) + void modifyColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException; /** @@ -749,12 +763,11 @@ public interface Admin extends Abortable, Closeable { * @param regionname region name to close * @param serverName Deprecated. Not used. * @throws IOException if a remote or network exception occurs - * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-18231). + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * Use {@link #unassign(byte[], boolean)}. */ @Deprecated - void closeRegion(final String regionname, final String serverName) throws IOException; + void closeRegion(String regionname, String serverName) throws IOException; /** * Uses {@link #unassign(byte[], boolean)} to unassign the region. For expert-admins. @@ -762,12 +775,11 @@ public interface Admin extends Abortable, Closeable { * @param regionname region name to close * @param serverName Deprecated. Not used. * @throws IOException if a remote or network exception occurs - * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-18231). + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * Use {@link #unassign(byte[], boolean)}. */ @Deprecated - void closeRegion(final byte[] regionname, final String serverName) throws IOException; + void closeRegion(byte[] regionname, String serverName) throws IOException; /** * Uses {@link #unassign(byte[], boolean)} to unassign the region. For expert-admins. @@ -777,14 +789,13 @@ public interface Admin extends Abortable, Closeable { * TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396., * then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396. * @param serverName Deprecated. Not used. - * @return Deprecated. Returns true always. + * @return Deprecated. Returns true always. * @throws IOException if a remote or network exception occurs - * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-18231). + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * Use {@link #unassign(byte[], boolean)}. */ @Deprecated - boolean closeRegionWithEncodedRegionName(final String encodedRegionName, final String serverName) + boolean closeRegionWithEncodedRegionName(String encodedRegionName, String serverName) throws IOException; /** @@ -801,7 +812,7 @@ public interface Admin extends Abortable, Closeable { /** * Get all the online regions on a region server. */ - List getOnlineRegions(final ServerName sn) throws IOException; + List getOnlineRegions(ServerName sn) throws IOException; /** * Flush a table. Synchronous operation. @@ -809,7 +820,7 @@ public interface Admin extends Abortable, Closeable { * @param tableName table to flush * @throws IOException if a remote or network exception occurs */ - void flush(final TableName tableName) throws IOException; + void flush(TableName tableName) throws IOException; /** * Flush an individual region. Synchronous operation. @@ -817,46 +828,56 @@ public interface Admin extends Abortable, Closeable { * @param regionName region to flush * @throws IOException if a remote or network exception occurs */ - void flushRegion(final byte[] regionName) throws IOException; + void flushRegion(byte[] regionName) throws IOException; /** - * Compact a table. Asynchronous operation. + * Compact a table. 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 tableName table to compact * @throws IOException if a remote or network exception occurs */ - void compact(final TableName tableName) throws IOException; + void compact(TableName tableName) throws IOException; /** - * Compact an individual region. Asynchronous operation. + * Compact an individual region. 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 regionName region to compact * @throws IOException if a remote or network exception occurs */ - void compactRegion(final byte[] regionName) throws IOException; + void compactRegion(byte[] regionName) throws IOException; /** - * Compact a column family within a table. Asynchronous operation. + * Compact a column family within a table. 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 tableName table to compact * @param columnFamily column family within a table * @throws IOException if a remote or network exception occurs */ - void compact(final TableName tableName, final byte[] columnFamily) + void compact(TableName tableName, byte[] columnFamily) throws IOException; /** - * Compact a column family within a region. Asynchronous operation. + * Compact a column family within a region. 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 regionName region to compact * @param columnFamily column family within a region * @throws IOException if a remote or network exception occurs */ - void compactRegion(final byte[] regionName, final byte[] columnFamily) + void compactRegion(byte[] regionName, byte[] columnFamily) throws IOException; /** - * Major compact a table. Asynchronous operation. + * Major compact a table. 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 tableName table to major compact * @throws IOException if a remote or network exception occurs @@ -864,41 +885,49 @@ public interface Admin extends Abortable, Closeable { void majorCompact(TableName tableName) throws IOException; /** - * Major compact a table or an individual region. Asynchronous operation. + * Major compact a table or an individual region. 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 regionName region to major compact * @throws IOException if a remote or network exception occurs */ - void majorCompactRegion(final byte[] regionName) throws IOException; + void majorCompactRegion(byte[] regionName) throws IOException; /** - * Major compact a column family within a table. Asynchronous operation. + * Major compact a column family within a table. 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 tableName table to major compact * @param columnFamily column family within a table * @throws IOException if a remote or network exception occurs */ - void majorCompact(TableName tableName, final byte[] columnFamily) + void majorCompact(TableName tableName, byte[] columnFamily) throws IOException; /** - * Major compact a column family within region. Asynchronous operation. + * Major compact a column family within region. 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 regionName egion to major compact * @param columnFamily column family within a region * @throws IOException if a remote or network exception occurs */ - void majorCompactRegion(final byte[] regionName, final byte[] columnFamily) + void majorCompactRegion(byte[] regionName, byte[] columnFamily) throws IOException; /** - * Compact all regions on the region server + * 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 sn the region server name * @param major if it's major compaction * @throws IOException * @throws InterruptedException */ - public void compactRegionServer(final ServerName sn, boolean major) + void compactRegionServer(ServerName sn, boolean major) throws IOException, InterruptedException; /** @@ -914,14 +943,13 @@ public interface Admin extends Abortable, Closeable { * @throws IOException if we can't find a region named * encodedRegionName */ - void move(final byte[] encodedRegionName, final byte[] destServerName) - throws IOException; + void move(byte[] encodedRegionName, byte[] destServerName) throws IOException; /** + * Assign a Region. * @param regionName Region name to assign. */ - void assign(final byte[] regionName) - throws IOException; + void assign(byte[] regionName) throws IOException; /** * Unassign a region from current hosting regionserver. Region will then be assigned to a @@ -929,10 +957,10 @@ public interface Admin extends Abortable, Closeable { * #move(byte[], byte[])} if you want to control the region movement. * * @param regionName Region to unassign. Will clear any existing RegionPlan if one found. - * @param force If true, force unassign (Will remove region from regions-in-transition too if + * @param force If true, force unassign (Will remove region from regions-in-transition too if * present. If results in double assignment use hbck -fix to resolve. To be used by experts). */ - void unassign(final byte[] regionName, final boolean force) + void unassign(byte[] regionName, boolean force) throws IOException; /** @@ -945,24 +973,52 @@ public interface Admin extends Abortable, Closeable { * @param regionName Region to offline. * @throws IOException */ - void offline(final byte[] regionName) throws IOException; + void offline(byte[] regionName) throws IOException; /** * Turn the load balancer on or off. * - * @param synchronous If true, it waits until current balance() call, if outstanding, to return. + * @param synchronous If true, it waits until current balance() call, if + * outstanding, to return. * @return Previous balancer value + * @deprecated Since 2.0.0. Will be removed in 3.0.0. + * Use {@link #balancerSwitch(boolean, boolean)} instead. */ - boolean setBalancerRunning(final boolean on, final boolean synchronous) - throws IOException; + @Deprecated + default boolean setBalancerRunning(boolean on, boolean synchronous) throws IOException { + return balancerSwitch(on, synchronous); + } + + /** + * Turn the load balancer on or off. + * @param onOrOff Set to true to enable, false to disable. + * @param synchronous If true, it waits until current balance() call, if + * outstanding, to return. + * @return Previous balancer value + */ + boolean balancerSwitch(boolean onOrOff, boolean synchronous) + throws IOException; + + /** + * Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the + * reassignments. Can NOT run for various reasons. Check logs. + * + * @return true if balancer ran, false otherwise. + * @deprecated Since 2.0.0. Will be removed in 3.0.0. + * Use {@link #balance()} instead. + */ + @Deprecated + default boolean balancer() throws IOException { + return balance(); + } /** * Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the * reassignments. Can NOT run for various reasons. Check logs. * - * @return True if balancer ran, false otherwise. + * @return true if balancer ran, false otherwise. */ - boolean balancer() throws IOException; + boolean balance() throws IOException; /** * Invoke the balancer. Will run the balancer and if regions to move, it will @@ -970,28 +1026,43 @@ public interface Admin extends Abortable, Closeable { * would still run balancer. Can *not* run for other reasons. Check * logs. * @param force whether we should force balance even if there is region in transition - * @return True if balancer ran, false otherwise. + * @return true if balancer ran, false otherwise. + * @deprecated Since 2.0.0. Will be removed in 3.0.0. + * Use {@link #balance(boolean)} instead. */ - boolean balancer(boolean force) throws IOException; + @Deprecated + default boolean balancer(boolean force) throws IOException { + return balance(force); + } /** - * Query the current state of the balancer + * Invoke the balancer. Will run the balancer and if regions to move, it will + * go ahead and do the reassignments. If there is region in transition, force parameter of true + * would still run balancer. Can *not* run for other reasons. Check + * logs. + * @param force whether we should force balance even if there is region in transition + * @return true if balancer ran, false otherwise. + */ + boolean balance(boolean force) throws IOException; + + /** + * Query the current state of the balancer. * - * @return true if the balancer is enabled, false otherwise. + * @return true if the balancer is enabled, false otherwise. */ boolean isBalancerEnabled() throws IOException; /** * Invoke region normalizer. Can NOT run for various reasons. Check logs. * - * @return True if region normalizer ran, false otherwise. + * @return true if region normalizer ran, false otherwise. */ boolean normalize() throws IOException; /** - * Query the current state of the region normalizer + * Query the current state of the region normalizer. * - * @return true if region normalizer is enabled, false otherwise. + * @return true if region normalizer is enabled, false otherwise. */ boolean isNormalizerEnabled() throws IOException; @@ -999,69 +1070,119 @@ public interface Admin extends Abortable, Closeable { * Turn region normalizer on or off. * * @return Previous normalizer value + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #normalizerSwitch(boolean)}} + * instead. */ - boolean setNormalizerRunning(final boolean on) - throws IOException; + @Deprecated + default boolean setNormalizerRunning(boolean on) throws IOException { + return normalizerSwitch(on); + } + + /** + * Turn region normalizer on or off. + * + * @return Previous normalizer value + */ + boolean normalizerSwitch (boolean on) throws IOException; /** - * Enable/Disable the catalog janitor + * Enable/Disable the catalog janitor. * - * @param enable if true enables the catalog janitor + * @param enable if true enables the catalog janitor * @return the previous state + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #catalogJanitorSwitch(boolean)}} + * instead. */ - boolean enableCatalogJanitor(boolean enable) throws IOException; + @Deprecated + default boolean enableCatalogJanitor(boolean enable) throws IOException { + return catalogJanitorSwitch(enable); + } /** - * Ask for a scan of the catalog table + * Enable/Disable the catalog janitor/ + * + * @param onOrOff if true enables the catalog janitor + * @return the previous state + */ + boolean catalogJanitorSwitch(boolean onOrOff) throws IOException; + + /** + * Ask for a scan of the catalog table. * * @return the number of entries cleaned + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #runCatalogJanitor()}} + * instead. */ - int runCatalogScan() throws IOException; + @Deprecated + default int runCatalogScan() throws IOException { + return runCatalogJanitor(); + } /** - * Query on the catalog janitor state (Enabled/Disabled?) + * Ask for a scan of the catalog table. + * + * @return the number of entries cleaned + */ + int runCatalogJanitor() throws IOException; + + /** + * Query on the catalog janitor state (Enabled/Disabled?). * */ boolean isCatalogJanitorEnabled() throws IOException; /** - * Enable/Disable the cleaner chore + * Enable/Disable the cleaner chore. + * + * @param on if true enables the cleaner chore + * @return the previous state + * @throws IOException + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #cleanerChoreSwitch(boolean)}} + * instead. + */ + @Deprecated + default boolean setCleanerChoreRunning(boolean on) throws IOException { + return cleanerChoreSwitch(on); + } + + /** + * Enable/Disable the cleaner chore. * - * @param on if true enables the cleaner chore + * @param onOrOff if true enables the cleaner chore * @return the previous state * @throws IOException */ - public boolean setCleanerChoreRunning(final boolean on) throws IOException; + boolean cleanerChoreSwitch(boolean onOrOff) throws IOException; /** - * Ask for cleaner chore to run + * Ask for cleaner chore to run. * - * @return True if cleaner chore ran, false otherwise + * @return true if cleaner chore ran, false otherwise * @throws IOException */ - public boolean runCleanerChore() throws IOException; + boolean runCleanerChore() throws IOException; /** - * Query on the cleaner chore state (Enabled/Disabled?) + * Query on the cleaner chore state (Enabled/Disabled?). * * @throws IOException */ - public boolean isCleanerChoreEnabled() throws IOException; + boolean isCleanerChoreEnabled() throws IOException; /** * Merge two regions. Asynchronous operation. * * @param nameOfRegionA encoded or full name of region a * @param nameOfRegionB encoded or full name of region b - * @param forcible true if do a compulsory merge, otherwise we will only merge two adjacent - * regions + * @param forcible true if do a compulsory merge, otherwise we will only merge two + * adjacent regions * @throws IOException * @deprecated Since 2.0. Will be removed in 3.0. Use * {@link #mergeRegionsAsync(byte[], byte[], boolean)} instead. */ @Deprecated - void mergeRegions(final byte[] nameOfRegionA, final byte[] nameOfRegionB, - final boolean forcible) throws IOException; + void mergeRegions(byte[] nameOfRegionA, byte[] nameOfRegionB, + boolean forcible) throws IOException; /** @@ -1069,46 +1190,45 @@ public interface Admin extends Abortable, Closeable { * * @param nameOfRegionA encoded or full name of region a * @param nameOfRegionB encoded or full name of region b - * @param forcible true if do a compulsory merge, otherwise we will only merge + * @param forcible true if do a compulsory merge, otherwise we will only merge * two adjacent regions * @throws IOException */ Future mergeRegionsAsync( - final byte[] nameOfRegionA, - final byte[] nameOfRegionB, - final boolean forcible) throws IOException; + byte[] nameOfRegionA, + byte[] nameOfRegionB, + boolean forcible) throws IOException; /** * Merge regions. Asynchronous operation. * * @param nameofRegionsToMerge encoded or full name of daughter regions - * @param forcible true if do a compulsory merge, otherwise we will only merge + * @param forcible true if do a compulsory merge, otherwise we will only merge * adjacent regions * @throws IOException */ Future mergeRegionsAsync( - final byte[][] nameofRegionsToMerge, - final boolean forcible) throws IOException; + byte[][] nameofRegionsToMerge, + boolean forcible) throws IOException; /** - * Split a table. Asynchronous operation. - * + + Split a table. The method will execute split action for each region in table. + + Asynchronous operation. * @param tableName table to split * @throws IOException if a remote or network exception occurs */ - void split(final TableName tableName) throws IOException; + void split(TableName tableName) throws IOException; /** * Split an individual region. Asynchronous operation. * * @param regionName region to split * @throws IOException if a remote or network exception occurs - * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-18229). + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * Use {@link #splitRegionAsync(byte[], byte[])}. */ @Deprecated - void splitRegion(final byte[] regionName) throws IOException; + void splitRegion(byte[] regionName) throws IOException; /** * Split a table. Asynchronous operation. @@ -1117,7 +1237,7 @@ public interface Admin extends Abortable, Closeable { * @param splitPoint the explicit position to split on * @throws IOException if a remote or network exception occurs */ - void split(final TableName tableName, final byte[] splitPoint) + void split(TableName tableName, byte[] splitPoint) throws IOException; /** @@ -1126,12 +1246,11 @@ public interface Admin extends Abortable, Closeable { * @param regionName region to split * @param splitPoint the explicit position to split on * @throws IOException if a remote or network exception occurs - * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-18229). + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * Use {@link #splitRegionAsync(byte[], byte[])}. */ @Deprecated - void splitRegion(final byte[] regionName, final byte[] splitPoint) + void splitRegion(byte[] regionName, byte[] splitPoint) throws IOException; /** @@ -1153,16 +1272,15 @@ public interface Admin extends Abortable, Closeable { * use {@link #modifyTable(TableDescriptor)} */ @Deprecated - void modifyTable(final TableName tableName, final TableDescriptor td) + void modifyTable(TableName tableName, TableDescriptor td) throws IOException; /** * Modify an existing table, more IRB friendly version. - * * @param td modified description of the table * @throws IOException if a remote or network exception occurs */ - void modifyTable(final TableDescriptor td) throws IOException; + void modifyTable(TableDescriptor td) throws IOException; /** * Modify an existing table, more IRB friendly version. Asynchronous operation. This means that @@ -1181,11 +1299,11 @@ public interface Admin extends Abortable, Closeable { * use {@link #modifyTableAsync(TableDescriptor)} */ @Deprecated - Future modifyTableAsync(final TableName tableName, final TableDescriptor td) + Future modifyTableAsync(TableName tableName, TableDescriptor td) throws IOException; /** - * Modify an existing table, more IRB friendly version. Asynchronous operation. This means that + * Modify an existing table, more IRB (ruby) friendly version. Asynchronous operation. This means that * it may be a while before your schema change is updated across all of the table. * 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 @@ -1201,7 +1319,7 @@ public interface Admin extends Abortable, Closeable { throws IOException; /** - * Shuts down the HBase cluster + * Shuts down the HBase cluster. * * @throws IOException if a remote or network exception occurs */ @@ -1216,20 +1334,20 @@ public interface Admin extends Abortable, Closeable { void stopMaster() throws IOException; /** - * Check whether Master is in maintenance mode + * Check whether Master is in maintenance mode. * * @throws IOException if a remote or network exception occurs */ boolean isMasterInMaintenanceMode() throws IOException; /** - * Stop the designated regionserver + * Stop the designated regionserver. * * @param hostnamePort Hostname and port delimited by a : as in * example.org:1234 * @throws IOException if a remote or network exception occurs */ - void stopRegionServer(final String hostnamePort) throws IOException; + void stopRegionServer(String hostnamePort) throws IOException; /** * Get whole cluster status, containing status about: @@ -1257,21 +1375,21 @@ public interface Admin extends Abortable, Closeable { /** * Get {@link RegionLoad} of all regions hosted on a regionserver. * - * @param sn region server from which regionload is required. + * @param serverName region server from which regionload is required. * @return region load map of all regions hosted on a region server * @throws IOException if a remote or network exception occurs */ - Map getRegionLoad(ServerName sn) throws IOException; + Map getRegionLoad(ServerName serverName) throws IOException; /** * Get {@link RegionLoad} of all regions hosted on a regionserver for a table. * - * @param sn region server from which regionload is required. + * @param serverName region server from which regionload is required. * @param tableName get region load of regions belonging to the table * @return region load map of all regions of a table hosted on a region server * @throws IOException if a remote or network exception occurs */ - Map getRegionLoad(ServerName sn, TableName tableName) throws IOException; + Map getRegionLoad(ServerName serverName, TableName tableName) throws IOException; /** * @return Configuration used by the instance. @@ -1282,19 +1400,19 @@ public interface Admin extends Abortable, Closeable { * Create a new namespace. Blocks until namespace has been successfully created or an exception * is thrown. * - * @param descriptor descriptor which describes the new namespace + * @param descriptor descriptor which describes the new namespace. */ - void createNamespace(final NamespaceDescriptor descriptor) + void createNamespace(NamespaceDescriptor descriptor) throws IOException; /** - * Create a new namespace + * Create a new namespace. * * @param descriptor descriptor which describes the new namespace * @return the result of the async create namespace operation. Use Future.get(long, TimeUnit) to * wait on the operation to complete. */ - Future createNamespaceAsync(final NamespaceDescriptor descriptor) + Future createNamespaceAsync(NamespaceDescriptor descriptor) throws IOException; /** @@ -1303,17 +1421,17 @@ public interface Admin extends Abortable, Closeable { * * @param descriptor descriptor which describes the new namespace */ - void modifyNamespace(final NamespaceDescriptor descriptor) + void modifyNamespace(NamespaceDescriptor descriptor) throws IOException; /** - * Modify an existing namespace + * Modify an existing namespace. * * @param descriptor descriptor which describes the new namespace * @return the result of the async modify namespace operation. Use Future.get(long, TimeUnit) to * wait on the operation to complete. */ - Future modifyNamespaceAsync(final NamespaceDescriptor descriptor) + Future modifyNamespaceAsync(NamespaceDescriptor descriptor) throws IOException; /** @@ -1323,7 +1441,7 @@ public interface Admin extends Abortable, Closeable { * * @param name namespace name */ - void deleteNamespace(final String name) throws IOException; + void deleteNamespace(String name) throws IOException; /** * Delete an existing namespace. Only empty namespaces (no tables) can be removed. @@ -1332,21 +1450,21 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async delete namespace operation. Use Future.get(long, TimeUnit) to * wait on the operation to complete. */ - Future deleteNamespaceAsync(final String name) throws IOException; + Future deleteNamespaceAsync(String name) throws IOException; /** - * Get a namespace descriptor by name + * Get a namespace descriptor by name. * * @param name name of namespace descriptor * @return A descriptor * @throws org.apache.hadoop.hbase.NamespaceNotFoundException * @throws IOException if a remote or network exception occurs */ - NamespaceDescriptor getNamespaceDescriptor(final String name) + NamespaceDescriptor getNamespaceDescriptor(String name) throws NamespaceNotFoundException, IOException; /** - * List available namespace descriptors + * List available namespace descriptors. * * @return List of descriptors */ @@ -1354,7 +1472,7 @@ public interface Admin extends Abortable, Closeable { throws IOException; /** - * Get list of table descriptors by namespace + * Get list of table descriptors by namespace. * * @param name namespace name * @return HTD[] the read-only tableDescriptors @@ -1363,27 +1481,27 @@ public interface Admin extends Abortable, Closeable { * use {@link #listTableDescriptorsByNamespace(byte[])} */ @Deprecated - HTableDescriptor[] listTableDescriptorsByNamespace(final String name) + HTableDescriptor[] listTableDescriptorsByNamespace(String name) throws IOException; /** - * Get list of table descriptors by namespace + * Get list of table descriptors by namespace. * * @param name namespace name * @return returns a list of TableDescriptors * @throws IOException */ - List listTableDescriptorsByNamespace(final byte[] name) + List listTableDescriptorsByNamespace(byte[] name) throws IOException; /** - * Get list of table names by namespace + * Get list of table names by namespace. * * @param name namespace name * @return The list of table names in the namespace * @throws IOException */ - TableName[] listTableNamesByNamespace(final String name) + TableName[] listTableNamesByNamespace(String name) throws IOException; /** @@ -1393,14 +1511,14 @@ public interface Admin extends Abortable, Closeable { * @return List of {@link HRegionInfo}. * @throws IOException */ - List getTableRegions(final TableName tableName) + List getTableRegions(TableName tableName) throws IOException; @Override void close() throws IOException; /** - * Get tableDescriptors + * Get tableDescriptors. * * @param tableNames List of table names * @return HTD[] the read-only tableDescriptors @@ -1413,7 +1531,7 @@ public interface Admin extends Abortable, Closeable { throws IOException; /** - * Get tableDescriptors + * Get tableDescriptors. * * @param tableNames List of table names * @return returns a list of TableDescriptors @@ -1423,7 +1541,7 @@ public interface Admin extends Abortable, Closeable { throws IOException; /** - * Get tableDescriptors + * Get tableDescriptors. * * @param names List of table names * @return HTD[] the read-only tableDescriptors @@ -1436,18 +1554,18 @@ public interface Admin extends Abortable, Closeable { throws IOException; /** - * abort a procedure + * Abort a procedure. * @param procId ID of the procedure to abort * @param mayInterruptIfRunning if the proc completed at least one step, should it be aborted? - * @return true if aborted, false if procedure already completed or does not exist + * @return true if aborted, false if procedure already completed or does not exist * @throws IOException */ boolean abortProcedure( - final long procId, - final boolean mayInterruptIfRunning) throws IOException; + long procId, + boolean mayInterruptIfRunning) throws IOException; /** - * Abort a procedure but does not block and wait for it be completely removed. + * Abort a procedure but does not block and wait for completion. * 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 @@ -1455,28 +1573,26 @@ public interface Admin extends Abortable, Closeable { * * @param procId ID of the procedure to abort * @param mayInterruptIfRunning if the proc completed at least one step, should it be aborted? - * @return true if aborted, false if procedure already completed or does not exist + * @return true if aborted, false if procedure already completed or does not exist * @throws IOException */ Future abortProcedureAsync( - final long procId, - final boolean mayInterruptIfRunning) throws IOException; + long procId, + boolean mayInterruptIfRunning) throws IOException; /** * Get procedures. * @return procedure list in JSON * @throws IOException */ - String getProcedures() - throws IOException; + String getProcedures() throws IOException; /** * Get locks. * @return lock list in JSON * @throws IOException if a remote or network exception occurs */ - String getLocks() - throws IOException; + String getLocks() throws IOException; /** * Roll the log writer. I.e. for filesystem based write ahead logs, start writing to a new file. @@ -1492,7 +1608,7 @@ public interface Admin extends Abortable, Closeable { void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException; /** - * Helper delegage to getClusterStatus().getMasterCoprocessors(). + * Helper that delegates to getClusterStatus().getMasterCoprocessors(). * @return an array of master coprocessors * @see org.apache.hadoop.hbase.ClusterStatus#getMasterCoprocessors() */ @@ -1506,8 +1622,7 @@ public interface Admin extends Abortable, Closeable { * @return the current compaction state * @throws IOException if a remote or network exception occurs */ - CompactionState getCompactionState(final TableName tableName) - throws IOException; + CompactionState getCompactionState(TableName tableName) throws IOException; /** * Get the current compaction state of region. It could be in a major compaction, a minor @@ -1517,8 +1632,7 @@ public interface Admin extends Abortable, Closeable { * @return the current compaction state * @throws IOException if a remote or network exception occurs */ - CompactionState getCompactionStateForRegion( - final byte[] regionName) throws IOException; + CompactionState getCompactionStateForRegion(byte[] regionName) throws IOException; /** * Get the timestamp of the last major compaction for the passed table @@ -1530,8 +1644,7 @@ public interface Admin extends Abortable, Closeable { * @return the last major compaction timestamp or 0 * @throws IOException if a remote or network exception occurs */ - long getLastMajorCompactionTimestamp(final TableName tableName) - throws IOException; + long getLastMajorCompactionTimestamp(TableName tableName) throws IOException; /** * Get the timestamp of the last major compaction for the passed region. @@ -1543,8 +1656,7 @@ public interface Admin extends Abortable, Closeable { * @return the last major compaction timestamp or 0 * @throws IOException if a remote or network exception occurs */ - long getLastMajorCompactionTimestampForRegion(final byte[] regionName) - throws IOException; + long getLastMajorCompactionTimestampForRegion(byte[] regionName) throws IOException; /** * Take a snapshot for the given table. If the table is enabled, a FLUSH-type snapshot will be @@ -1561,7 +1673,7 @@ public interface Admin extends Abortable, Closeable { * @throws org.apache.hadoop.hbase.snapshot.SnapshotCreationException if snapshot creation failed * @throws IllegalArgumentException if the snapshot request is formatted incorrectly */ - void snapshot(final String snapshotName, final TableName tableName) + void snapshot(String snapshotName, TableName tableName) throws IOException, SnapshotCreationException, IllegalArgumentException; /** @@ -1577,7 +1689,7 @@ public interface Admin extends Abortable, Closeable { * @throws SnapshotCreationException if snapshot creation failed * @throws IllegalArgumentException if the snapshot request is formatted incorrectly */ - void snapshot(final byte[] snapshotName, final TableName tableName) + void snapshot(byte[] snapshotName, TableName tableName) throws IOException, SnapshotCreationException, IllegalArgumentException; /** @@ -1595,8 +1707,8 @@ public interface Admin extends Abortable, Closeable { * @throws SnapshotCreationException if snapshot creation failed * @throws IllegalArgumentException if the snapshot request is formatted incorrectly */ - void snapshot(final String snapshotName, - final TableName tableName, + void snapshot(String snapshotName, + TableName tableName, SnapshotType type) throws IOException, SnapshotCreationException, IllegalArgumentException; @@ -1629,9 +1741,25 @@ public interface Admin extends Abortable, Closeable { * @throws IOException if the snapshot did not succeed or we lose contact with the master. * @throws SnapshotCreationException if snapshot creation failed * @throws IllegalArgumentException if the snapshot request is formatted incorrectly + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use + * {@link #snapshotAsync(SnapshotDescription)} instead. */ - void takeSnapshotAsync(SnapshotDescription snapshot) - throws IOException, SnapshotCreationException; + @Deprecated + default void takeSnapshotAsync(SnapshotDescription snapshot) + throws IOException, SnapshotCreationException { + snapshotAsync(snapshot); + } + + /** + * Take a snapshot without waiting for the server to complete that snapshot (asynchronous) Only a + * single snapshot should be taken at a time, or results may be undefined. + * + * @param snapshot snapshot to take + * @throws IOException if the snapshot did not succeed or we lose contact with the master. + * @throws SnapshotCreationException if snapshot creation failed + * @throws IllegalArgumentException if the snapshot request is formatted incorrectly + */ + void snapshotAsync(SnapshotDescription snapshot) throws IOException, SnapshotCreationException; /** * Check the current state of the passed snapshot. There are three possible states:

    @@ -1649,12 +1777,12 @@ public interface Admin extends Abortable, Closeable { * @throws org.apache.hadoop.hbase.snapshot.UnknownSnapshotException if the requested snapshot is * unknown */ - boolean isSnapshotFinished(final SnapshotDescription snapshot) + boolean isSnapshotFinished(SnapshotDescription snapshot) throws IOException, HBaseSnapshotException, UnknownSnapshotException; /** * Restore the specified snapshot on the original table. (The table must be disabled) If the - * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a + * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a * snapshot of the current table is taken before executing the restore operation. In case of * restore failure, the failsafe snapshot will be restored. If the restore completes without * problem the failsafe snapshot is deleted. @@ -1665,11 +1793,11 @@ public interface Admin extends Abortable, Closeable { * restored * @throws IllegalArgumentException if the restore request is formatted incorrectly */ - void restoreSnapshot(final byte[] snapshotName) throws IOException, RestoreSnapshotException; + void restoreSnapshot(byte[] snapshotName) throws IOException, RestoreSnapshotException; /** * Restore the specified snapshot on the original table. (The table must be disabled) If the - * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a + * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a * snapshot of the current table is taken before executing the restore operation. In case of * restore failure, the failsafe snapshot will be restored. If the restore completes without * problem the failsafe snapshot is deleted. @@ -1679,11 +1807,11 @@ public interface Admin extends Abortable, Closeable { * @throws RestoreSnapshotException if snapshot failed to be restored * @throws IllegalArgumentException if the restore request is formatted incorrectly */ - void restoreSnapshot(final String snapshotName) throws IOException, RestoreSnapshotException; + void restoreSnapshot(String snapshotName) throws IOException, RestoreSnapshotException; /** * Restore the specified snapshot on the original table. (The table must be disabled) If the - * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a + * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a * snapshot of the current table is taken before executing the restore operation. In case of * restore failure, the failsafe snapshot will be restored. If the restore completes without * problem the failsafe snapshot is deleted. @@ -1694,59 +1822,59 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async restore snapshot. You can use Future.get(long, TimeUnit) * to wait on the operation to complete. */ - Future restoreSnapshotAsync(final String snapshotName) + Future restoreSnapshotAsync(String snapshotName) throws IOException, RestoreSnapshotException; /** * Restore the specified snapshot on the original table. (The table must be disabled) If - * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before + * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before * executing the restore operation. In case of restore failure, the failsafe snapshot will be * restored. If the restore completes without problem the failsafe snapshot is deleted. The * failsafe snapshot name is configurable by using the property * "hbase.snapshot.restore.failsafe.name". * * @param snapshotName name of the snapshot to restore - * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken + * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken * @throws IOException if a remote or network exception occurs * @throws RestoreSnapshotException if snapshot failed to be restored * @throws IllegalArgumentException if the restore request is formatted incorrectly */ - void restoreSnapshot(final byte[] snapshotName, final boolean takeFailSafeSnapshot) + void restoreSnapshot(byte[] snapshotName, boolean takeFailSafeSnapshot) throws IOException, RestoreSnapshotException; /** * Restore the specified snapshot on the original table. (The table must be disabled) If - * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before + * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before * executing the restore operation. In case of restore failure, the failsafe snapshot will be * restored. If the restore completes without problem the failsafe snapshot is deleted. The * failsafe snapshot name is configurable by using the property * "hbase.snapshot.restore.failsafe.name". * * @param snapshotName name of the snapshot to restore - * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken + * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken * @throws IOException if a remote or network exception occurs * @throws RestoreSnapshotException if snapshot failed to be restored * @throws IllegalArgumentException if the restore request is formatted incorrectly */ - void restoreSnapshot(final String snapshotName, final boolean takeFailSafeSnapshot) + void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot) throws IOException, RestoreSnapshotException; /** * Restore the specified snapshot on the original table. (The table must be disabled) If - * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before + * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before * executing the restore operation. In case of restore failure, the failsafe snapshot will be * restored. If the restore completes without problem the failsafe snapshot is deleted. The * failsafe snapshot name is configurable by using the property * "hbase.snapshot.restore.failsafe.name". * @param snapshotName name of the snapshot to restore - * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken - * @param restoreAcl true to restore acl of snapshot + * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken + * @param restoreAcl true to restore acl of snapshot * @throws IOException if a remote or network exception occurs * @throws RestoreSnapshotException if snapshot failed to be restored * @throws IllegalArgumentException if the restore request is formatted incorrectly */ - void restoreSnapshot(final String snapshotName, final boolean takeFailSafeSnapshot, - final boolean restoreAcl) throws IOException, RestoreSnapshotException; + void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot, + boolean restoreAcl) throws IOException, RestoreSnapshotException; /** * Create a new table by cloning the snapshot content. @@ -1758,20 +1886,20 @@ public interface Admin extends Abortable, Closeable { * @throws RestoreSnapshotException if snapshot failed to be cloned * @throws IllegalArgumentException if the specified table has not a valid name */ - void cloneSnapshot(final byte[] snapshotName, final TableName tableName) + void cloneSnapshot(byte[] snapshotName, TableName tableName) throws IOException, TableExistsException, RestoreSnapshotException; /** * Create a new table by cloning the snapshot content. * @param snapshotName name of the snapshot to be cloned * @param tableName name of the table where the snapshot will be restored - * @param restoreAcl true to clone acl into newly created table + * @param restoreAcl true to clone acl into newly created table * @throws IOException if a remote or network exception occurs * @throws TableExistsException if table to be created already exists * @throws RestoreSnapshotException if snapshot failed to be cloned * @throws IllegalArgumentException if the specified table has not a valid name */ - void cloneSnapshot(final String snapshotName, final TableName tableName, final boolean restoreAcl) + void cloneSnapshot(String snapshotName, TableName tableName, boolean restoreAcl) throws IOException, TableExistsException, RestoreSnapshotException; /** @@ -1784,12 +1912,12 @@ public interface Admin extends Abortable, Closeable { * @throws RestoreSnapshotException if snapshot failed to be cloned * @throws IllegalArgumentException if the specified table has not a valid name */ - void cloneSnapshot(final String snapshotName, final TableName tableName) + void cloneSnapshot(String snapshotName, TableName tableName) throws IOException, TableExistsException, RestoreSnapshotException; /** * Create a new table by cloning the snapshot content, but does not block - * and wait for it be completely cloned. + * and wait for it to be completely cloned. * 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 @@ -1802,7 +1930,7 @@ public interface Admin extends Abortable, Closeable { * @return the result of the async clone snapshot. You can use Future.get(long, TimeUnit) * to wait on the operation to complete. */ - Future cloneSnapshotAsync(final String snapshotName, final TableName tableName) + Future cloneSnapshotAsync(String snapshotName, TableName tableName) throws IOException, TableExistsException; /** @@ -1828,9 +1956,28 @@ public interface Admin extends Abortable, Closeable { * @param props Property/Value pairs of properties passing to the procedure * @return data returned after procedure execution. null if no return data. * @throws IOException + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use + * {@link #execProcedureWithReturn(String, String, Map)} } instead. */ - byte[] execProcedureWithRet(String signature, String instance, Map props) - throws IOException; + @Deprecated + default byte[] execProcedureWithRet(String signature, String instance, Map props) + throws IOException { + return execProcedureWithReturn(signature, instance, props); + } + + /** + * Execute a distributed procedure on a cluster. + * + * @param signature A distributed procedure is uniquely identified by its signature (default the + * root ZK node name of the procedure). + * @param instance The instance name of the procedure. For some procedures, this parameter is + * optional. + * @param props Property/Value pairs of properties passing to the procedure + * @return data returned after procedure execution. null if no return data. + * @throws IOException + */ + byte[] execProcedureWithReturn(String signature, String instance, Map props) + throws IOException; /** * Check the current state of the specified procedure. There are three possible states:
      @@ -1840,7 +1987,7 @@ public interface Admin extends Abortable, Closeable { * @param signature The signature that uniquely identifies a procedure * @param instance The instance name of the procedure * @param props Property/Value pairs of properties passing to the procedure - * @return true if the specified procedure is finished successfully, false if it is still running + * @return true if the specified procedure is finished successfully, false if it is still running * @throws IOException if the specified procedure finished with error */ boolean isProcedureFinished(String signature, String instance, Map props) @@ -1858,7 +2005,7 @@ public interface Admin extends Abortable, Closeable { * List all the completed snapshots matching the given regular expression. * * @param regex The regular expression to match against - * @return - returns a List of SnapshotDescription + * @return list of SnapshotDescription * @throws IOException if a remote or network exception occurs */ List listSnapshots(String regex) throws IOException; @@ -1867,7 +2014,7 @@ public interface Admin extends Abortable, Closeable { * List all the completed snapshots matching the given pattern. * * @param pattern The compiled regular expression to match against - * @return - returns a List of SnapshotDescription + * @return list of SnapshotDescription * @throws IOException if a remote or network exception occurs */ List listSnapshots(Pattern pattern) throws IOException; @@ -1877,7 +2024,7 @@ public interface Admin extends Abortable, Closeable { * name regular expression. * @param tableNameRegex The table name regular expression to match against * @param snapshotNameRegex The snapshot name regular expression to match against - * @return - returns a List of completed SnapshotDescription + * @return list of completed SnapshotDescription * @throws IOException if a remote or network exception occurs */ List listTableSnapshots(String tableNameRegex, @@ -1888,7 +2035,7 @@ public interface Admin extends Abortable, Closeable { * name regular expression. * @param tableNamePattern The compiled table name regular expression to match against * @param snapshotNamePattern The compiled snapshot name regular expression to match against - * @return - returns a List of completed SnapshotDescription + * @return list of completed SnapshotDescription * @throws IOException if a remote or network exception occurs */ List listTableSnapshots(Pattern tableNamePattern, @@ -1900,7 +2047,7 @@ public interface Admin extends Abortable, Closeable { * @param snapshotName name of the snapshot * @throws IOException if a remote or network exception occurs */ - void deleteSnapshot(final byte[] snapshotName) throws IOException; + void deleteSnapshot(byte[] snapshotName) throws IOException; /** * Delete an existing snapshot. @@ -1908,7 +2055,7 @@ public interface Admin extends Abortable, Closeable { * @param snapshotName name of the snapshot * @throws IOException if a remote or network exception occurs */ - void deleteSnapshot(final String snapshotName) throws IOException; + void deleteSnapshot(String snapshotName) throws IOException; /** * Delete existing snapshots whose names match the pattern passed. @@ -1916,7 +2063,7 @@ public interface Admin extends Abortable, Closeable { * @param regex The regular expression to match against * @throws IOException if a remote or network exception occurs */ - void deleteSnapshots(final String regex) throws IOException; + void deleteSnapshots(String regex) throws IOException; /** * Delete existing snapshots whose names match the pattern passed. @@ -1924,7 +2071,7 @@ public interface Admin extends Abortable, Closeable { * @param pattern pattern for names of the snapshot to match * @throws IOException if a remote or network exception occurs */ - void deleteSnapshots(final Pattern pattern) throws IOException; + void deleteSnapshots(Pattern pattern) throws IOException; /** * Delete all existing snapshots matching the given table name regular expression and snapshot @@ -1951,7 +2098,7 @@ public interface Admin extends Abortable, Closeable { * @param quota the quota settings * @throws IOException if a remote or network exception occurs */ - void setQuota(final QuotaSettings quota) throws IOException; + void setQuota(QuotaSettings quota) throws IOException; /** * Return a QuotaRetriever to list the quotas based on the filter. @@ -1960,7 +2107,7 @@ public interface Admin extends Abortable, Closeable { * @return the quota retriever * @throws IOException if a remote or network exception occurs */ - QuotaRetriever getQuotaRetriever(final QuotaFilter filter) throws IOException; + QuotaRetriever getQuotaRetriever(QuotaFilter filter) throws IOException; /** * Creates and returns a {@link com.google.protobuf.RpcChannel} instance connected to the active @@ -2000,15 +2147,15 @@ public interface Admin extends Abortable, Closeable { * MyCallResponse response = service.myCall(null, request); * * - * @param sn the server name to which the endpoint call is made + * @param serverName the server name to which the endpoint call is made * @return A RegionServerCoprocessorRpcChannel instance */ - CoprocessorRpcChannel coprocessorService(ServerName sn); + CoprocessorRpcChannel coprocessorService(ServerName serverName); /** * Update the configuration and trigger an online config change - * on the regionserver + * on the regionserver. * @param server : The server whose config needs to be updated. * @throws IOException */ @@ -2017,7 +2164,7 @@ public interface Admin extends Abortable, Closeable { /** * Update the configuration and trigger an online config change - * on all the regionservers + * on all the regionservers. * @throws IOException */ void updateConfiguration() throws IOException; @@ -2027,21 +2174,25 @@ public interface Admin extends Abortable, Closeable { * @return master info port * @throws IOException */ - public int getMasterInfoPort() throws IOException; + int getMasterInfoPort() throws IOException; /** - * Compact a table. Asynchronous operation. + * Compact a table. 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 tableName table to compact * @param compactType {@link org.apache.hadoop.hbase.client.CompactType} * @throws IOException * @throws InterruptedException */ - void compact(final TableName tableName, CompactType compactType) + void compact(TableName tableName, CompactType compactType) throws IOException, InterruptedException; /** - * Compact a column family within a table. Asynchronous operation. + * Compact a column family within a table. 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 tableName table to compact * @param columnFamily column family within a table @@ -2049,22 +2200,26 @@ public interface Admin extends Abortable, Closeable { * @throws IOException if not a mob column family or if a remote or network exception occurs * @throws InterruptedException */ - void compact(final TableName tableName, final byte[] columnFamily, CompactType compactType) + void compact(TableName tableName, byte[] columnFamily, CompactType compactType) throws IOException, InterruptedException; /** - * Major compact a table. Asynchronous operation. + * Major compact a table. 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 tableName table to compact * @param compactType {@link org.apache.hadoop.hbase.client.CompactType} * @throws IOException * @throws InterruptedException */ - void majorCompact(final TableName tableName, CompactType compactType) + void majorCompact(TableName tableName, CompactType compactType) throws IOException, InterruptedException; /** - * Major compact a column family within a table. Asynchronous operation. + * Major compact a column family within a table. 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 tableName table to compact * @param columnFamily column family within a table @@ -2072,7 +2227,7 @@ public interface Admin extends Abortable, Closeable { * @throws IOException if not a mob column family or if a remote or network exception occurs * @throws InterruptedException */ - void majorCompact(final TableName tableName, final byte[] columnFamily, CompactType compactType) + void majorCompact(TableName tableName, byte[] columnFamily, CompactType compactType) throws IOException, InterruptedException; /** @@ -2083,7 +2238,7 @@ public interface Admin extends Abortable, Closeable { * @return the current compaction state * @throws IOException if a remote or network exception occurs */ - CompactionState getCompactionState(final TableName tableName, + CompactionState getCompactionState(TableName tableName, CompactType compactType) throws IOException; /** @@ -2097,76 +2252,104 @@ public interface Admin extends Abortable, Closeable { * Turn the Split or Merge switches on or off. * * @param enabled enabled or not - * @param synchronous If true, it waits until current split() call, if outstanding, to return. + * @param synchronous If true, it waits until current split() call, if outstanding, to return. * @param switchTypes switchType list {@link MasterSwitchType} * @return Previous switch value array + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use + * {@link #splitOrMergeEnabledSwitch(boolean, boolean, MasterSwitchType...)}. */ - boolean[] setSplitOrMergeEnabled(final boolean enabled, final boolean synchronous, - final MasterSwitchType... switchTypes) throws IOException; + @Deprecated + default boolean[] setSplitOrMergeEnabled(boolean enabled, boolean synchronous, + MasterSwitchType... switchTypes) throws IOException { + return splitOrMergeEnabledSwitch(enabled, synchronous, switchTypes); + } + + /** + * Turn the Split or Merge switches on or off. + * + * @param enabled enabled or not + * @param synchronous If true, it waits until current split() call, if outstanding, to return. + * @param switchTypes switchType list {@link MasterSwitchType} + * @return Previous switch value array + */ + boolean[] splitOrMergeEnabledSwitch(boolean enabled, boolean synchronous, + MasterSwitchType... switchTypes) throws IOException; + + /** + * Query the current state of the switch. + * + * @return true if the switch is enabled, false otherwise. + * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use + * {@link #splitOrMergeEnabledSwitch(MasterSwitchType)}} instead. + */ + @Deprecated + default boolean isSplitOrMergeEnabled(MasterSwitchType switchType) throws IOException { + return splitOrMergeEnabledSwitch(switchType); + } /** - * Query the current state of the switch + * Query the current state of the switch. * - * @return true if the switch is enabled, false otherwise. + * @return true if the switch is enabled, false otherwise. */ - boolean isSplitOrMergeEnabled(final MasterSwitchType switchType) throws IOException; + boolean splitOrMergeEnabledSwitch(MasterSwitchType switchType) throws IOException; /** - * Add a new replication peer for replicating data to slave cluster + * Add a new replication peer for replicating data to slave cluster. * @param peerId a short name that identifies the peer * @param peerConfig configuration for the replication slave cluster * @throws IOException */ - default void addReplicationPeer(final String peerId, final ReplicationPeerConfig peerConfig) + default void addReplicationPeer(String peerId, ReplicationPeerConfig peerConfig) throws IOException { } /** - * Remove a peer and stop the replication + * Remove a peer and stop the replication. * @param peerId a short name that identifies the peer * @throws IOException */ - default void removeReplicationPeer(final String peerId) throws IOException { + default void removeReplicationPeer(String peerId) throws IOException { } /** - * Restart the replication stream to the specified peer + * Restart the replication stream to the specified peer. * @param peerId a short name that identifies the peer * @throws IOException */ - default void enableReplicationPeer(final String peerId) throws IOException { + default void enableReplicationPeer(String peerId) throws IOException { } /** - * Stop the replication stream to the specified peer + * Stop the replication stream to the specified peer. * @param peerId a short name that identifies the peer * @throws IOException */ - default void disableReplicationPeer(final String peerId) throws IOException { + default void disableReplicationPeer(String peerId) throws IOException { } /** - * Returns the configured ReplicationPeerConfig for the specified peer + * Returns the configured ReplicationPeerConfig for the specified peer. * @param peerId a short name that identifies the peer * @return ReplicationPeerConfig for the peer * @throws IOException */ - default ReplicationPeerConfig getReplicationPeerConfig(final String peerId) throws IOException { + default ReplicationPeerConfig getReplicationPeerConfig(String peerId) throws IOException { return new ReplicationPeerConfig(); } /** - * Update the peerConfig for the specified peer + * Update the peerConfig for the specified peer. * @param peerId a short name that identifies the peer * @param peerConfig new config for the peer * @throws IOException */ - default void updateReplicationPeerConfig(final String peerId, - final ReplicationPeerConfig peerConfig) throws IOException { + default void updateReplicationPeerConfig(String peerId, + ReplicationPeerConfig peerConfig) throws IOException { } /** - * Append the replicable table-cf config of the specified peer + * Append the replicable table column family config from the specified peer. * @param id a short that identifies the cluster * @param tableCfs A map from tableName to column family names * @throws ReplicationException @@ -2178,7 +2361,7 @@ public interface Admin extends Abortable, Closeable { } /** - * Remove some table-cfs from config of the specified peer + * Remove some table-cfs from config of the specified peer. * @param id a short name that identifies the cluster * @param tableCfs A map from tableName to column family names * @throws ReplicationException @@ -2247,23 +2430,23 @@ public interface Admin extends Abortable, Closeable { * @param tableName name of the table * @throws IOException if a remote or network exception occurs */ - void enableTableReplication(final TableName tableName) throws IOException; + void enableTableReplication(TableName tableName) throws IOException; /** * Disable a table's replication switch. * @param tableName name of the table * @throws IOException if a remote or network exception occurs */ - void disableTableReplication(final TableName tableName) throws IOException; + void disableTableReplication(TableName tableName) throws IOException; /** * Clear compacting queues on a regionserver. - * @param sn the region server name + * @param serverName the region server name * @param queues the set of queue name * @throws IOException if a remote or network exception occurs * @throws InterruptedException */ - void clearCompactionQueues(final ServerName sn, final Set queues) + void clearCompactionQueues(ServerName serverName, Set queues) throws IOException, InterruptedException; /** 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 692d189ea9..c2d22a4a87 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 @@ -342,7 +342,7 @@ public class HBaseAdmin implements Admin { } @Override - public TableDescriptor listTableDescriptor(TableName tableName) throws TableNotFoundException, IOException { + public TableDescriptor getDescriptor(TableName tableName) throws TableNotFoundException, IOException { return getTableDescriptor(tableName, getConnection(), rpcCallerFactory, rpcControllerFactory, operationTimeout, rpcTimeout); } @@ -1410,7 +1410,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean setBalancerRunning(final boolean on, final boolean synchronous) + public boolean balancerSwitch(final boolean on, final boolean synchronous) throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override @@ -1423,7 +1423,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean balancer() throws IOException { + public boolean balance() throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { @@ -1434,7 +1434,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean balancer(final boolean force) throws IOException { + public boolean balance(final boolean force) throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { @@ -1478,7 +1478,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean setNormalizerRunning(final boolean on) throws IOException { + public boolean normalizerSwitch(final boolean on) throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { @@ -1490,7 +1490,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean enableCatalogJanitor(final boolean enable) throws IOException { + public boolean catalogJanitorSwitch(final boolean enable) throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { @@ -1501,7 +1501,7 @@ public class HBaseAdmin implements Admin { } @Override - public int runCatalogScan() throws IOException { + public int runCatalogJanitor() throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override protected Integer rpcCall() throws Exception { @@ -1523,7 +1523,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean setCleanerChoreRunning(final boolean on) throws IOException { + public boolean cleanerChoreSwitch(final boolean on) throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override public Boolean rpcCall() throws Exception { return master.setCleanerChoreRunning(getRpcController(), RequestConverter @@ -2556,7 +2556,7 @@ public class HBaseAdmin implements Admin { } @Override - public void takeSnapshotAsync(SnapshotDescription snapshotDesc) throws IOException, + public void snapshotAsync(SnapshotDescription snapshotDesc) throws IOException, SnapshotCreationException { asyncSnapshot(ProtobufUtil.createHBaseProtosSnapshotDesc(snapshotDesc)); } @@ -2763,7 +2763,7 @@ public class HBaseAdmin implements Admin { } @Override - public byte[] execProcedureWithRet(String signature, String instance, Map props) + public byte[] execProcedureWithReturn(String signature, String instance, Map props) throws IOException { ProcedureDescription desc = ProtobufUtil.buildProcedureDescription(signature, instance, props); final ExecProcedureRequest request = @@ -3643,7 +3643,7 @@ public class HBaseAdmin implements Admin { * @return the table descriptor */ protected TableDescriptor getTableDescriptor() throws IOException { - return getAdmin().listTableDescriptor(getTableName()); + return getAdmin().getDescriptor(getTableName()); } /** @@ -3841,7 +3841,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean[] setSplitOrMergeEnabled(final boolean enabled, final boolean synchronous, + public boolean[] splitOrMergeEnabledSwitch(final boolean enabled, final boolean synchronous, final MasterSwitchType... switchTypes) throws IOException { return executeCallable(new MasterCallable(getConnection(), @@ -3863,7 +3863,7 @@ public class HBaseAdmin implements Admin { } @Override - public boolean isSplitOrMergeEnabled(final MasterSwitchType switchType) throws IOException { + public boolean splitOrMergeEnabledSwitch(final MasterSwitchType switchType) throws IOException { return executeCallable(new MasterCallable(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java index d1a760bdab..58795323f6 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java @@ -422,7 +422,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { LOG.info("Creating table:" + td); admin.createTable(td, startKey, endKey, numRegions); Assert.assertTrue("Table: " + td + " was not created", admin.tableExists(tableName)); - TableDescriptor freshTableDesc = admin.listTableDescriptor(tableName); + TableDescriptor freshTableDesc = admin.getDescriptor(tableName); Assert.assertTrue( "After create, Table: " + tableName + " in not enabled", admin.isTableEnabled(tableName)); enabledTables.put(tableName, freshTableDesc); @@ -461,7 +461,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { admin.disableTable(tableName); Assert.assertTrue("Table: " + selected + " was not disabled", admin.isTableDisabled(tableName)); - TableDescriptor freshTableDesc = admin.listTableDescriptor(tableName); + TableDescriptor freshTableDesc = admin.getDescriptor(tableName); Assert.assertTrue( "After disable, Table: " + tableName + " is not disabled", admin.isTableDisabled(tableName)); @@ -510,7 +510,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { admin.enableTable(tableName); Assert.assertTrue("Table: " + selected + " was not enabled", admin.isTableEnabled(tableName)); - TableDescriptor freshTableDesc = admin.listTableDescriptor(tableName); + TableDescriptor freshTableDesc = admin.getDescriptor(tableName); Assert.assertTrue( "After enable, Table: " + tableName + " in not enabled", admin.isTableEnabled(tableName)); enabledTables.put(tableName, freshTableDesc); @@ -607,7 +607,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { LOG.info("Adding column family: " + cfd + " to table: " + tableName); admin.addColumnFamily(tableName, cfd); // assertion - TableDescriptor freshTableDesc = admin.listTableDescriptor(tableName); + TableDescriptor freshTableDesc = admin.getDescriptor(tableName); Assert.assertTrue("Column family: " + cfd + " was not added", freshTableDesc.hasColumnFamily(cfd.getName())); Assert.assertTrue( @@ -659,7 +659,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { admin.modifyTable(td); // assertion - TableDescriptor freshTableDesc = admin.listTableDescriptor(tableName); + TableDescriptor freshTableDesc = admin.getDescriptor(tableName); ColumnFamilyDescriptor freshColumnDesc = freshTableDesc.getColumnFamily(columnDesc.getName()); Assert.assertEquals("Column family: " + columnDesc + " was not altered", freshColumnDesc.getMaxVersions(), versions); @@ -750,7 +750,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { LOG.info("Deleting column family: " + cfd + " from table: " + tableName); admin.deleteColumnFamily(tableName, cfd.getName()); // assertion - TableDescriptor freshTableDesc = admin.listTableDescriptor(tableName); + TableDescriptor freshTableDesc = admin.getDescriptor(tableName); Assert.assertFalse("Column family: " + cfd + " was not added", freshTableDesc.hasColumnFamily(cfd.getName())); Assert.assertTrue( @@ -801,7 +801,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { put.addColumn(family, qualifier, value); table.put(put); } - TableDescriptor freshTableDesc = admin.listTableDescriptor(tableName); + TableDescriptor freshTableDesc = admin.getDescriptor(tableName); Assert.assertTrue( "After insert, Table: " + tableName + " in not enabled", admin.isTableEnabled(tableName)); enabledTables.put(tableName, freshTableDesc); diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java index 2f01afeaba..3994aae358 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java @@ -254,7 +254,7 @@ public class Action { HBaseTestingUtility util = this.context.getHBaseIntegrationTestingUtility(); Admin admin = util.getAdmin(); - TableDescriptor tableDescriptor = admin.listTableDescriptor(tableName); + TableDescriptor tableDescriptor = admin.getDescriptor(tableName); ColumnFamilyDescriptor[] columnDescriptors = tableDescriptor.getColumnFamilies(); if (columnDescriptors == null || columnDescriptors.length == 0) { diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java index 509f7b6540..1098ff9a21 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java @@ -52,7 +52,7 @@ public class RemoveColumnAction extends Action { @Override public void perform() throws Exception { - TableDescriptor tableDescriptor = admin.listTableDescriptor(tableName); + TableDescriptor tableDescriptor = admin.getDescriptor(tableName); ColumnFamilyDescriptor[] columnDescriptors = tableDescriptor.getColumnFamilies(); if (columnDescriptors.length <= (protectedColumns == null ? 1 : protectedColumns.size())) { diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java index 3a47f1b17e..679d991887 100644 --- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java +++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java @@ -161,7 +161,7 @@ public class CopyTable extends Configured implements Tool { try (Connection conn = ConnectionFactory.createConnection(getConf()); Admin admin = conn.getAdmin()) { HFileOutputFormat2.configureIncrementalLoadMap(job, - admin.listTableDescriptor((TableName.valueOf(dstTableName)))); + admin.getDescriptor((TableName.valueOf(dstTableName)))); } } else { TableMapReduceUtil.initTableMapperJob(tableName, scan, diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/ExpiredMobFileCleaner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/ExpiredMobFileCleaner.java index 3827fd18bf..3924ee6483 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/ExpiredMobFileCleaner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/ExpiredMobFileCleaner.java @@ -98,7 +98,7 @@ public class ExpiredMobFileCleaner extends Configured implements Tool { Connection connection = ConnectionFactory.createConnection(getConf()); Admin admin = connection.getAdmin(); try { - TableDescriptor htd = admin.listTableDescriptor(tn); + TableDescriptor htd = admin.getDescriptor(tn); ColumnFamilyDescriptor family = htd.getColumnFamily(Bytes.toBytes(familyName)); if (family == null || !family.isMobEnabled()) { throw new IOException("Column family " + familyName + " is not a MOB column family"); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHColumnDescriptorDefaultVersions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHColumnDescriptorDefaultVersions.java index d85326f81b..47f0add5a7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHColumnDescriptorDefaultVersions.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHColumnDescriptorDefaultVersions.java @@ -154,7 +154,7 @@ public class TestHColumnDescriptorDefaultVersions { Admin admin = TEST_UTIL.getAdmin(); // Verify descriptor from master - TableDescriptor htd = admin.listTableDescriptor(tableName); + TableDescriptor htd = admin.getDescriptor(tableName); ColumnFamilyDescriptor[] hcds = htd.getColumnFamilies(); verifyHColumnDescriptor(expected, hcds, tableName, families); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java index c2c6d283e1..7661ed426c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java @@ -319,14 +319,14 @@ public class TestReplicaWithCluster { Assert.assertFalse(r.isStale()); // Add a CF, it should work. - TableDescriptor bHdt = HTU.getAdmin().listTableDescriptor(td.getTableName()); + TableDescriptor bHdt = HTU.getAdmin().getDescriptor(td.getTableName()); td = TableDescriptorBuilder.newBuilder(td) .addColumnFamily(ColumnFamilyDescriptorBuilder.of(row)) .build(); HTU.getAdmin().disableTable(td.getTableName()); HTU.getAdmin().modifyTable(td); HTU.getAdmin().enableTable(td.getTableName()); - TableDescriptor nHdt = HTU.getAdmin().listTableDescriptor(td.getTableName()); + TableDescriptor nHdt = HTU.getAdmin().getDescriptor(td.getTableName()); Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()), bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount()); @@ -350,7 +350,7 @@ public class TestReplicaWithCluster { } Admin admin = HTU.getAdmin(); - nHdt =admin.listTableDescriptor(td.getTableName()); + nHdt =admin.getDescriptor(td.getTableName()); Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()), bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount()); -- 2.11.0 (Apple Git-81)