http://git-wip-us.apache.org/repos/asf/hbase/blob/274bbb64/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java index 19290f0..0a82a6b 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. - * <p>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. + * <p>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 <code>true</code> 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<TableDescriptor> 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 <code>false</code> 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 <code>false</code> 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 <code>false</code> 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 <code>false</code> 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 <code>false</code> 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 <code>false</code> 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<Void> createTableAsync(final TableDescriptor desc, final byte[][] splitKeys) + Future<Void> 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 <code>true</code> 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 <code>true</code> 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<Void> truncateTableAsync(final TableName tableName, final boolean preserveSplits) + Future<Void> 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<Void> enableTableAsync(final TableName tableName) throws IOException; + Future<Void> 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<Void> disableTableAsync(final TableName tableName) throws IOException; + Future<Void> 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 <code>true</code> 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 <code>true</code> 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 <code>true</code> 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 <code>false</code>. * * @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 <code>alter</code> (a.k.a <code>modify</code>) 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<Integer, Integer> getAlterStatus(final TableName tableName) throws IOException; + @Deprecated + Pair<Integer, Integer> 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 <code>alter</code> (a.k.a <code>modify</code>) 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<Integer, Integer> getAlterStatus(final byte[] tableName) throws IOException; + Pair<Integer, Integer> 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. - * (<a href="https://issues.apache.org/jira/browse/HBASE-1989">HBASE-1989</a>). * 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<Void> addColumnFamilyAsync(final TableName tableName, final ColumnFamilyDescriptor columnFamily) + Future<Void> 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. - * (<a href="https://issues.apache.org/jira/browse/HBASE-1989">HBASE-1989</a>). * 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<Void> deleteColumnFamilyAsync(final TableName tableName, final byte[] columnFamily) + Future<Void> 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. - * (<a href="https://issues.apache.org/jira/browse/HBASE-1989">HBASE-1989</a>). * 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 - * (<a href="https://issues.apache.org/jira/browse/HBASE-18231">HBASE-18231</a>). + * @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 - * (<a href="https://issues.apache.org/jira/browse/HBASE-18231">HBASE-18231</a>). + * @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 { * <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>, * then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>. * @param serverName Deprecated. Not used. - * @return Deprecated. Returns true always. + * @return Deprecated. Returns <code>true</code> 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 - * (<a href="https://issues.apache.org/jira/browse/HBASE-18231">HBASE-18231</a>). + * @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<HRegionInfo> getOnlineRegions(final ServerName sn) throws IOException; + List<HRegionInfo> 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 * <code>encodedRegionName</code> */ - 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 <code>true</code>, 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 <code>true</code>, 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 <code>true</code> to enable, <code>false</code> to disable. + * @param synchronous If <code>true</code>, 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 <code>true</code> if balancer ran, <code>false</code> 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 <code>true</code> if balancer ran, <code>false</code> 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 <code>true</code> if balancer ran, <code>false</code> 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 <code>true</code> if balancer ran, <code>false</code> otherwise. + */ + boolean balance(boolean force) throws IOException; + + /** + * Query the current state of the balancer. * - * @return true if the balancer is enabled, false otherwise. + * @return <code>true</code> if the balancer is enabled, <code>false</code> 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 <code>true</code> if region normalizer ran, <code>false</code> 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 <code>true</code> if region normalizer is enabled, <code>false</code> 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 <code>true</code> 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 <code>true</code> 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 <code>true</code> 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 <code>true</code> 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 <code>true</code> if cleaner chore ran, <code>false</code> 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 <code>true</code> 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 <code>true</code> if do a compulsory merge, otherwise we will only merge * two adjacent regions * @throws IOException */ Future<Void> 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 <code>true</code> if do a compulsory merge, otherwise we will only merge * adjacent regions * @throws IOException */ Future<Void> 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 - * (<a href="https://issues.apache.org/jira/browse/HBASE-18229">HBASE-18229</a>). + * @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 - * (<a href="https://issues.apache.org/jira/browse/HBASE-18229">HBASE-18229</a>). + * @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<Void> modifyTableAsync(final TableName tableName, final TableDescriptor td) + Future<Void> 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 <code>:</code> as in * <code>example.org:1234</code> * @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<byte[], RegionLoad> getRegionLoad(ServerName sn) throws IOException; + Map<byte[], RegionLoad> 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<byte[], RegionLoad> getRegionLoad(ServerName sn, TableName tableName) throws IOException; + Map<byte[], RegionLoad> 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<Void> createNamespaceAsync(final NamespaceDescriptor descriptor) + Future<Void> 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<Void> modifyNamespaceAsync(final NamespaceDescriptor descriptor) + Future<Void> 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<Void> deleteNamespaceAsync(final String name) throws IOException; + Future<Void> 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<TableDescriptor> listTableDescriptorsByNamespace(final byte[] name) + List<TableDescriptor> 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<HRegionInfo> getTableRegions(final TableName tableName) + List<HRegionInfo> 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 <code>true</code> if aborted, <code>false</code> 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 <code>true</code> if aborted, <code>false</code> if procedure already completed or does not exist * @throws IOException */ Future<Boolean> 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: <ol> @@ -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 <code>true</code>, 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 <code>true</code>, 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 <code>true</code>, 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<Void> restoreSnapshotAsync(final String snapshotName) + Future<Void> 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 <code>true</code>, 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 <code>true</code> 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 <code>true</code>, 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 <code>true</code> 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 <code>true</code>, 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 <code>true</code> if the failsafe snapshot should be taken + * @param restoreAcl <code>true</code> 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 <code>true</code> 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<Void> cloneSnapshotAsync(final String snapshotName, final TableName tableName) + Future<Void> 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<String, String> props) - throws IOException; + @Deprecated + default byte[] execProcedureWithRet(String signature, String instance, Map<String, String> 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<String, String> props) + throws IOException; /** * Check the current state of the specified procedure. There are three possible states: <ol> @@ -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 <code>true</code> if the specified procedure is finished successfully, <code>false</code> if it is still running * @throws IOException if the specified procedure finished with error */ boolean isProcedureFinished(String signature, String instance, Map<String, String> 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<SnapshotDescription> 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<SnapshotDescription> 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<SnapshotDescription> 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<SnapshotDescription> 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); * </pre></blockquote></div> * - * @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 <code>true</code>, 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 t
<TRUNCATED>