Class HBaseAdmin

java.lang.Object
org.apache.hadoop.hbase.client.HBaseAdmin
All Implemented Interfaces:
Closeable, AutoCloseable, Abortable, Admin

@Private public class HBaseAdmin extends Object implements Admin
HBaseAdmin is no longer a client API. It is marked InterfaceAudience.Private indicating that this is an HBase-internal class as defined in https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/InterfaceClassification.html There are no guarantees for backwards source / binary compatibility and methods or class can change or go away without deprecation. Use Connection.getAdmin() to obtain an instance of Admin instead of constructing an HBaseAdmin directly.

Connection should be an unmanaged connection obtained via ConnectionFactory.createConnection(Configuration)

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getOperationTimeout

      public int getOperationTimeout()
      Description copied from interface: Admin
      Return the operation timeout for a rpc call.
      Specified by:
      getOperationTimeout in interface Admin
      See Also:
    • getSyncWaitTimeout

      public int getSyncWaitTimeout()
      Description copied from interface: Admin
      Return the blocking wait time for an asynchronous operation. Can be configured by hbase.client.sync.wait.timeout.msec.

      For several operations, such as createTable, deleteTable, etc, the rpc call will finish right after we schedule a procedure at master side, so the timeout will not be controlled by the above Admin.getOperationTimeout(). And timeout value here tells you how much time we will wait until the procedure at master side is finished.

      In general, you can consider that the implementation for XXXX method is just a XXXXAsync().get(getSyncWaitTimeout(), TimeUnit.MILLISECONDS).

      Specified by:
      getSyncWaitTimeout in interface Admin
      See Also:
    • abort

      public void abort(String why, Throwable e)
      Description copied from interface: Abortable
      Abort the server or client.
      Specified by:
      abort in interface Abortable
      Specified by:
      abort in interface Admin
      Parameters:
      why - Why we're aborting.
      e - Throwable that caused abort. Can be null.
    • isAborted

      public boolean isAborted()
      Description copied from interface: Abortable
      Check if the server or client was aborted.
      Specified by:
      isAborted in interface Abortable
      Specified by:
      isAborted in interface Admin
      Returns:
      true if the server or client was aborted, false otherwise
    • abortProcedure

      public boolean abortProcedure(long procId, boolean mayInterruptIfRunning) throws IOException
      Description copied from interface: Admin
      Abort a procedure.

      Do not use. Usually it is ignored but if not, it can do more damage than good. See hbck2.

      Specified by:
      abortProcedure in interface Admin
      Parameters:
      procId - ID of the procedure to abort
      mayInterruptIfRunning - if the proc completed at least one step, should it be aborted?
      Returns:
      true if aborted, false if procedure already completed or does not exist
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • abortProcedureAsync

      public Future<Boolean> abortProcedureAsync(long procId, boolean mayInterruptIfRunning) throws IOException
      Description copied from interface: Admin
      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 operation to complete. Do not use. Usually it is ignored but if not, it can do more damage than good. See hbck2.
      Specified by:
      abortProcedureAsync in interface Admin
      Parameters:
      procId - ID of the procedure to abort
      mayInterruptIfRunning - if the proc completed at least one step, should it be aborted?
      Returns:
      true if aborted, false if procedure already completed or does not exist
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • listTableDescriptors

      Description copied from interface: Admin
      List all the userspace tables.
      Specified by:
      listTableDescriptors in interface Admin
      Returns:
      a list of TableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
    • listTableDescriptorsByState

      public List<TableDescriptor> listTableDescriptorsByState(boolean isEnabled) throws IOException
      Description copied from interface: Admin
      List all enabled or disabled tables
      Specified by:
      listTableDescriptorsByState in interface Admin
      Parameters:
      isEnabled - is true means return enabled tables, false means return disabled tables
      Returns:
      a list of enabled or disabled tables
      Throws:
      IOException
    • listTableDescriptors

      public List<TableDescriptor> listTableDescriptors(Pattern pattern, boolean includeSysTables) throws IOException
      Description copied from interface: Admin
      List all the tables matching the given pattern.
      Specified by:
      listTableDescriptors in interface Admin
      Parameters:
      pattern - The compiled regular expression to match against
      includeSysTables - false to match only against userspace tables
      Returns:
      a list of TableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • getDescriptor

      Description copied from interface: Admin
      Get a table descriptor.
      Specified by:
      getDescriptor in interface Admin
      Parameters:
      tableName - as a TableName
      Returns:
      the tableDescriptor
      Throws:
      TableNotFoundException - if the table was not found
      IOException - if a remote or network exception occurs
    • modifyTableAsync

      public Future<Void> modifyTableAsync(TableDescriptor td, boolean reopenRegions) throws IOException
      Description copied from interface: Admin
      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 or TimeoutException in case the wait timeout was not long enough to allow the operation to complete.
      Specified by:
      modifyTableAsync in interface Admin
      Parameters:
      td - description of the table
      reopenRegions - By default, 'modifyTableAsync' reopens all regions, potentially causing a RIT(Region In Transition) storm in large tables. If set to 'false', regions will remain unaware of the modification until they are individually reopened. Please note that this may temporarily result in configuration inconsistencies among regions.
      Returns:
      the result of the async modify. You can use Future.get(long, TimeUnit) to wait on the operation to complete
      Throws:
      IOException - if a remote or network exception occurs
    • modifyTableStoreFileTrackerAsync

      Description copied from interface: Admin
      Change the store file tracker of the given table.
      Specified by:
      modifyTableStoreFileTrackerAsync in interface Admin
      Parameters:
      tableName - the table you want to change
      dstSFT - the destination store file tracker
      Returns:
      the result of the async modify. You can use Future.get(long, TimeUnit) to wait on the operation to complete
      Throws:
      IOException - if a remote or network exception occurs
    • listTableDescriptorsByNamespace

      Description copied from interface: Admin
      Get list of table descriptors by namespace.
      Specified by:
      listTableDescriptorsByNamespace in interface Admin
      Parameters:
      name - namespace name
      Returns:
      returns a list of TableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
    • listTableDescriptors

      Description copied from interface: Admin
      Get tableDescriptors.
      Specified by:
      listTableDescriptors in interface Admin
      Parameters:
      tableNames - List of table names
      Returns:
      returns a list of TableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
    • getRegions

      Description copied from interface: Admin
      Get all the online regions on a region server.
      Specified by:
      getRegions in interface Admin
      Returns:
      List of RegionInfo
      Throws:
      IOException - if a remote or network exception occurs
    • getRegions

      public List<RegionInfo> getRegions(TableName tableName) throws IOException
      Description copied from interface: Admin
      Get the regions of a given table.
      Specified by:
      getRegions in interface Admin
      Parameters:
      tableName - the name of the table
      Returns:
      List of RegionInfo.
      Throws:
      IOException - if a remote or network exception occurs
    • getConnection

      Returns Connection used by this object.
      Specified by:
      getConnection in interface Admin
    • tableExists

      public boolean tableExists(TableName tableName) throws IOException
      Description copied from interface: Admin
      Check if a table exists.
      Specified by:
      tableExists in interface Admin
      Parameters:
      tableName - Table to check.
      Returns:
      true if table exists already.
      Throws:
      IOException - if a remote or network exception occurs
    • listTables

      Description copied from interface: Admin
      List all the userspace tables.
      Specified by:
      listTables in interface Admin
      Returns:
      an array of read-only HTableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • listTables

      public HTableDescriptor[] listTables(Pattern pattern) throws IOException
      Description copied from interface: Admin
      List all the userspace tables that match the given pattern.
      Specified by:
      listTables in interface Admin
      Parameters:
      pattern - The compiled regular expression to match against
      Returns:
      an array of read-only HTableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • listTables

      public HTableDescriptor[] listTables(String regex) throws IOException
      Description copied from interface: Admin
      List all the userspace tables matching the given regular expression.
      Specified by:
      listTables in interface Admin
      Parameters:
      regex - The regular expression to match against
      Returns:
      a list of read-only HTableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • listTables

      public HTableDescriptor[] listTables(Pattern pattern, boolean includeSysTables) throws IOException
      Description copied from interface: Admin
      List all the tables matching the given pattern.
      Specified by:
      listTables in interface Admin
      Parameters:
      pattern - The compiled regular expression to match against
      includeSysTables - false to match only against userspace tables
      Returns:
      an array of read-only HTableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • listTables

      public HTableDescriptor[] listTables(String regex, boolean includeSysTables) throws IOException
      Description copied from interface: Admin
      List all the tables matching the given pattern.
      Specified by:
      listTables in interface Admin
      Parameters:
      regex - The regular expression to match against
      includeSysTables - false to match only against userspace tables
      Returns:
      an array of read-only HTableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • listTableNames

      Description copied from interface: Admin
      List all of the names of userspace tables.
      Specified by:
      listTableNames in interface Admin
      Returns:
      TableName[] table names
      Throws:
      IOException - if a remote or network exception occurs
    • listTableNames

      public TableName[] listTableNames(String regex) throws IOException
      Description copied from interface: Admin
      List all of the names of userspace tables.
      Specified by:
      listTableNames in interface Admin
      Parameters:
      regex - The regular expression to match against
      Returns:
      TableName[] table names
      Throws:
      IOException - if a remote or network exception occurs
    • listTableNames

      public TableName[] listTableNames(Pattern pattern, boolean includeSysTables) throws IOException
      Description copied from interface: Admin
      List all of the names of userspace tables.
      Specified by:
      listTableNames in interface Admin
      Parameters:
      pattern - The regular expression to match against
      includeSysTables - false to match only against userspace tables
      Returns:
      TableName[] table names
      Throws:
      IOException - if a remote or network exception occurs
    • listTableNames

      public TableName[] listTableNames(String regex, boolean includeSysTables) throws IOException
      Description copied from interface: Admin
      List all of the names of userspace tables.
      Specified by:
      listTableNames in interface Admin
      Parameters:
      regex - The regular expression to match against
      includeSysTables - false to match only against userspace tables
      Returns:
      TableName[] table names
      Throws:
      IOException - if a remote or network exception occurs
    • listTableNamesByState

      public List<TableName> listTableNamesByState(boolean isEnabled) throws IOException
      Description copied from interface: Admin
      List all enabled or disabled table names
      Specified by:
      listTableNamesByState in interface Admin
      Parameters:
      isEnabled - is true means return enabled table names, false means return disabled table names
      Returns:
      a list of enabled or disabled table names
      Throws:
      IOException
    • getTableDescriptor

      Description copied from interface: Admin
      Get a table descriptor.
      Specified by:
      getTableDescriptor in interface Admin
      Parameters:
      tableName - as a TableName
      Returns:
      the read-only tableDescriptor
      Throws:
      TableNotFoundException - if the table was not found
      IOException - if a remote or network exception occurs
    • getTableDescriptor

      static TableDescriptor getTableDescriptor(TableName tableName, Connection connection, RpcRetryingCallerFactory rpcCallerFactory, RpcControllerFactory rpcControllerFactory, int operationTimeout, int rpcTimeout) throws IOException
      Throws:
      IOException
    • getHTableDescriptor

      @Deprecated static HTableDescriptor getHTableDescriptor(TableName tableName, Connection connection, RpcRetryingCallerFactory rpcCallerFactory, RpcControllerFactory rpcControllerFactory, int operationTimeout, int rpcTimeout) throws IOException
      Deprecated.
      Throws:
      IOException
    • getPauseTime

      private long getPauseTime(int tries)
    • createTable

      public void createTable(TableDescriptor desc, byte[] startKey, byte[] endKey, int numRegions) throws IOException
      Description copied from interface: Admin
      Creates a new table with the specified number of regions. The start key specified will become the end key of the first region of the table, and the end key specified will become the start key of the last region of the table (the first region has a null start key and the last region has a null end key). BigInteger math will be used to divide the key range specified into enough segments to make the required number of total regions. Synchronous operation.
      Specified by:
      createTable in interface Admin
      Parameters:
      desc - table descriptor for table
      startKey - beginning of key range
      endKey - end of key range
      numRegions - the total number of regions to create
      Throws:
      IOException - if a remote or network exception occurs
      MasterNotRunningException - if master is not running
      TableExistsException - if table already exists (If concurrent threads, the table may have been created between test-for-existence and attempt-at-creation).
    • createTableAsync

      public Future<Void> createTableAsync(TableDescriptor desc, byte[][] splitKeys) throws IOException
      Description copied from interface: Admin
      Creates a new table but does not block and wait for it to come online. 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.

      Throws IllegalArgumentException Bad table name, if the split keys are repeated and if the split key has empty byte array.

      Specified by:
      createTableAsync in interface Admin
      Parameters:
      desc - table descriptor for table
      splitKeys - keys to check if the table has been created with all split keys
      Returns:
      the result of the async creation. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • deleteTableAsync

      public Future<Void> deleteTableAsync(TableName tableName) throws IOException
      Description copied from interface: Admin
      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 operation to complete.
      Specified by:
      deleteTableAsync in interface Admin
      Parameters:
      tableName - name of table to delete
      Returns:
      the result of the async delete. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • deleteTables

      Description copied from interface: Admin
      Deletes tables matching the passed in pattern and wait on completion. Warning: Use this method carefully, there is no prompting and the effect is immediate. Consider using Admin.listTableDescriptors(Pattern) and Admin.deleteTable(org.apache.hadoop.hbase.TableName)
      Specified by:
      deleteTables in interface Admin
      Parameters:
      regex - The regular expression to match table names against
      Returns:
      Table descriptors for tables that couldn't be deleted. The return htds are read-only
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • deleteTables

      public HTableDescriptor[] deleteTables(Pattern pattern) throws IOException
      Delete tables matching the passed in pattern and wait on completion. Warning: Use this method carefully, there is no prompting and the effect is immediate. Consider using listTables(java.util.regex.Pattern) and Admin.deleteTable(TableName)
      Specified by:
      deleteTables in interface Admin
      Parameters:
      pattern - The pattern to match table names against
      Returns:
      Table descriptors for tables that couldn't be deleted
      Throws:
      IOException - if a remote or network exception occurs
    • truncateTableAsync

      public Future<Void> truncateTableAsync(TableName tableName, boolean preserveSplits) throws IOException
      Description copied from interface: Admin
      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.
      Specified by:
      truncateTableAsync in interface Admin
      Parameters:
      tableName - name of table to delete
      preserveSplits - true if the splits should be preserved
      Returns:
      the result of the async truncate. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • getTableSplits

      private byte[][] getTableSplits(TableName tableName) throws IOException
      Throws:
      IOException
    • enableTableAsync

      public Future<Void> enableTableAsync(TableName tableName) throws IOException
      Description copied from interface: Admin
      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 operation to complete.
      Specified by:
      enableTableAsync in interface Admin
      Parameters:
      tableName - name of table to delete
      Returns:
      the result of the async enable. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • enableTables

      Description copied from interface: Admin
      Enable tables matching the passed in pattern and wait on completion. Warning: Use this method carefully, there is no prompting and the effect is immediate. Consider using Admin.listTableDescriptors(Pattern) and Admin.enableTable(org.apache.hadoop.hbase.TableName)
      Specified by:
      enableTables in interface Admin
      Parameters:
      regex - The regular expression to match table names against
      Returns:
      Table descriptors for tables that couldn't be enabled. The return HTDs are read-only.
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • enableTables

      public HTableDescriptor[] enableTables(Pattern pattern) throws IOException
      Description copied from interface: Admin
      Enable tables matching the passed in pattern and wait on completion. Warning: Use this method carefully, there is no prompting and the effect is immediate. Consider using Admin.listTableDescriptors(java.util.regex.Pattern) and Admin.enableTable(org.apache.hadoop.hbase.TableName)
      Specified by:
      enableTables in interface Admin
      Parameters:
      pattern - The pattern to match table names against
      Returns:
      Table descriptors for tables that couldn't be enabled. The return HTDs are read-only.
      Throws:
      IOException - if a remote or network exception occurs
    • disableTableAsync

      public Future<Void> disableTableAsync(TableName tableName) throws IOException
      Description copied from interface: Admin
      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 operation to complete.
      Specified by:
      disableTableAsync in interface Admin
      Parameters:
      tableName - name of table to delete
      Returns:
      the result of the async disable. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • disableTables

      Description copied from interface: Admin
      Disable tables matching the passed in pattern and wait on completion. Warning: Use this method carefully, there is no prompting and the effect is immediate. Consider using Admin.listTableDescriptors(Pattern) and Admin.disableTable(org.apache.hadoop.hbase.TableName)
      Specified by:
      disableTables in interface Admin
      Parameters:
      regex - The regular expression to match table names against
      Returns:
      Table descriptors for tables that couldn't be disabled The return htds are read-only
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • disableTables

      Description copied from interface: Admin
      Disable tables matching the passed in pattern and wait on completion. Warning: Use this method carefully, there is no prompting and the effect is immediate. Consider using Admin.listTableDescriptors(java.util.regex.Pattern) and Admin.disableTable(org.apache.hadoop.hbase.TableName)
      Specified by:
      disableTables in interface Admin
      Parameters:
      pattern - The pattern to match table names against
      Returns:
      Table descriptors for tables that couldn't be disabled The return htds are read-only
      Throws:
      IOException - if a remote or network exception occurs
    • isTableEnabled

      public boolean isTableEnabled(TableName tableName) throws IOException
      Description copied from interface: Admin
      Check if a table is enabled.
      Specified by:
      isTableEnabled in interface Admin
      Parameters:
      tableName - name of table to check
      Returns:
      true if table is on-line
      Throws:
      IOException - if a remote or network exception occurs
    • isTableDisabled

      public boolean isTableDisabled(TableName tableName) throws IOException
      Description copied from interface: Admin
      Check if a table is disabled.
      Specified by:
      isTableDisabled in interface Admin
      Parameters:
      tableName - name of table to check
      Returns:
      true if table is off-line
      Throws:
      IOException - if a remote or network exception occurs
    • isTableAvailable

      public boolean isTableAvailable(TableName tableName) throws IOException
      Description copied from interface: Admin
      Check if a table is available.
      Specified by:
      isTableAvailable in interface Admin
      Parameters:
      tableName - name of table to check
      Returns:
      true if all regions of the table are available
      Throws:
      IOException - if a remote or network exception occurs
    • isTableAvailable

      public boolean isTableAvailable(TableName tableName, byte[][] splitKeys) throws IOException
      Description copied from interface: Admin
      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.
      Specified by:
      isTableAvailable in interface Admin
      Parameters:
      tableName - name of table to check
      splitKeys - keys to check if the table has been created with all split keys
      Throws:
      IOException - if a remote or network excpetion occurs
    • getAlterStatus

      Description copied from interface: Admin
      Get the status of an alter (a.k.a modify) command - indicates how many regions have received the updated schema Asynchronous operation.
      Specified by:
      getAlterStatus in interface Admin
      Parameters:
      tableName - TableName instance
      Returns:
      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
    • getAlterStatus

      public Pair<Integer,Integer> getAlterStatus(byte[] tableName) throws IOException
      Description copied from interface: Admin
      Get the status of alter (a.k.a modify) command - indicates how many regions have received the updated schema Asynchronous operation.
      Specified by:
      getAlterStatus in interface Admin
      Parameters:
      tableName - name of the table to get the status of
      Returns:
      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
    • addColumnFamilyAsync

      public Future<Void> addColumnFamilyAsync(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException
      Description copied from interface: Admin
      Add a column family to an existing table. Asynchronous operation. 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.
      Specified by:
      addColumnFamilyAsync in interface Admin
      Parameters:
      tableName - name of the table to add column family to
      columnFamily - column family descriptor of column family to be added
      Returns:
      the result of the async add column family. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • deleteColumn

      @Deprecated public void deleteColumn(TableName tableName, byte[] columnFamily) throws IOException
      Deprecated.
      Since 2.0. Will be removed in 3.0. Use Admin.deleteColumnFamily(TableName, byte[]) instead.
      Delete a column family from a table. Synchronous operation. Use Admin.deleteColumnFamily(TableName, byte[]) instead because it returns a Future from which you can learn whether success or failure.
      Specified by:
      deleteColumn in interface Admin
      Parameters:
      tableName - name of table
      columnFamily - name of column family to be deleted
      Throws:
      IOException - if a remote or network exception occurs
    • deleteColumnFamilyAsync

      public Future<Void> deleteColumnFamilyAsync(TableName tableName, byte[] columnFamily) throws IOException
      Description copied from interface: Admin
      Delete a column family from a table. Asynchronous operation. 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.
      Specified by:
      deleteColumnFamilyAsync in interface Admin
      Parameters:
      tableName - name of table
      columnFamily - name of column family to be deleted
      Returns:
      the result of the async delete column family. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • modifyColumnFamilyAsync

      Description copied from interface: Admin
      Modify an existing column family on a table. Asynchronous operation. 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.
      Specified by:
      modifyColumnFamilyAsync in interface Admin
      Parameters:
      tableName - name of table
      columnFamily - new column family descriptor to use
      Returns:
      the result of the async modify column family. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • modifyColumnFamilyStoreFileTrackerAsync

      public Future<Void> modifyColumnFamilyStoreFileTrackerAsync(TableName tableName, byte[] family, String dstSFT) throws IOException
      Description copied from interface: Admin
      Change the store file tracker of the given table's given family.
      Specified by:
      modifyColumnFamilyStoreFileTrackerAsync in interface Admin
      Parameters:
      tableName - the table you want to change
      family - the family you want to change
      dstSFT - the destination store file tracker
      Returns:
      the result of the async modify. You can use Future.get(long, TimeUnit) to wait on the operation to complete
      Throws:
      IOException - if a remote or network exception occurs
    • closeRegion

      @Deprecated public void closeRegion(String regionName, String unused) throws IOException
      Deprecated.
      Description copied from interface: Admin
      Uses Admin.unassign(byte[], boolean) to unassign the region. For expert-admins.
      Specified by:
      closeRegion in interface Admin
      Parameters:
      regionName - region name to close
      unused - Deprecated. Not used.
      Throws:
      IOException - if a remote or network exception occurs
    • closeRegion

      @Deprecated public void closeRegion(byte[] regionName, String unused) throws IOException
      Deprecated.
      Description copied from interface: Admin
      Uses Admin.unassign(byte[], boolean) to unassign the region. For expert-admins.
      Specified by:
      closeRegion in interface Admin
      Parameters:
      regionName - region name to close
      unused - Deprecated. Not used.
      Throws:
      IOException - if a remote or network exception occurs
    • closeRegionWithEncodedRegionName

      @Deprecated public boolean closeRegionWithEncodedRegionName(String encodedRegionName, String unused) throws IOException
      Deprecated.
      Description copied from interface: Admin
      Uses Admin.unassign(byte[], boolean) to unassign the region. For expert-admins.
      Specified by:
      closeRegionWithEncodedRegionName in interface Admin
      Parameters:
      encodedRegionName - The encoded region name; i.e. the hash that makes up the region name suffix: e.g. if regionname is TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396., then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396.
      unused - Deprecated. Not used.
      Returns:
      Deprecated. Returns true always.
      Throws:
      IOException - if a remote or network exception occurs
    • closeRegion

      @Deprecated public void closeRegion(ServerName unused, HRegionInfo hri) throws IOException
      Deprecated.
      Description copied from interface: Admin
      Used Admin.unassign(byte[], boolean) to unassign the region. For expert-admins.
      Specified by:
      closeRegion in interface Admin
      Parameters:
      unused - Deprecated. Not used.
      Throws:
      IOException - if a remote or network exception occurs
    • getOnlineRegions

      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0 Use getRegions(ServerName).
      Description copied from interface: Admin
      Get all the online regions on a region server.
      Specified by:
      getOnlineRegions in interface Admin
      Returns:
      List of HRegionInfo.
      Throws:
      IOException - if a remote or network exception occurs
    • flush

      public void flush(TableName tableName) throws IOException
      Description copied from interface: Admin
      Flush a table. Synchronous operation.
      Specified by:
      flush in interface Admin
      Parameters:
      tableName - table to flush
      Throws:
      IOException - if a remote or network exception occurs
    • flush

      public void flush(TableName tableName, byte[] columnFamily) throws IOException
      Description copied from interface: Admin
      Flush the specified column family stores on all regions of the passed table. This runs as a synchronous operation.
      Specified by:
      flush in interface Admin
      Parameters:
      tableName - table to flush
      columnFamily - column family within a table
      Throws:
      IOException - if a remote or network exception occurs
    • flushAsync

      public Future<Void> flushAsync(TableName tableName, List<byte[]> columnFamilies) throws IOException
      Description copied from interface: Admin
      Flush a table but does not block and wait for it to finish. 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.
      Specified by:
      flushAsync in interface Admin
      Parameters:
      tableName - table to flush
      columnFamilies - column families within a table
      Returns:
      the result of the async creation. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • flushRegion

      public void flushRegion(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Flush an individual region. Synchronous operation.
      Specified by:
      flushRegion in interface Admin
      Parameters:
      regionName - region to flush
      Throws:
      IOException - if a remote or network exception occurs
    • flushRegion

      public void flushRegion(byte[] regionName, byte[] columnFamily) throws IOException
      Description copied from interface: Admin
      Flush a column family within a region. Synchronous operation.
      Specified by:
      flushRegion in interface Admin
      Parameters:
      regionName - region to flush
      columnFamily - column family within a region
      Throws:
      IOException - if a remote or network exception occurs
    • flush

      private void flush(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, RegionInfo info, byte[] columnFamily) throws IOException
      Throws:
      IOException
    • flushRegionServer

      public void flushRegionServer(ServerName serverName) throws IOException
      Description copied from interface: Admin
      Flush all regions on the region server. Synchronous operation.
      Specified by:
      flushRegionServer in interface Admin
      Parameters:
      serverName - the region server name to flush
      Throws:
      IOException - if a remote or network exception occurs
    • compact

      public void compact(TableName tableName) throws IOException
      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).
      Specified by:
      compact in interface Admin
      Parameters:
      tableName - table to compact
      Throws:
      IOException - if a remote or network exception occurs
    • compactRegion

      public void compactRegion(byte[] regionName) throws IOException
      Description copied from interface: Admin
      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).
      Specified by:
      compactRegion in interface Admin
      Parameters:
      regionName - region to compact
      Throws:
      IOException - if a remote or network exception occurs
    • compact

      public void compact(TableName tableName, byte[] columnFamily) throws IOException
      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).
      Specified by:
      compact in interface Admin
      Parameters:
      tableName - table to compact
      columnFamily - column family within a table
      Throws:
      IOException - if a remote or network exception occurs
    • compactRegion

      public void compactRegion(byte[] regionName, byte[] columnFamily) throws IOException
      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).
      Specified by:
      compactRegion in interface Admin
      Parameters:
      regionName - region to compact
      columnFamily - column family within a region
      Throws:
      IOException - if a remote or network exception occurs
    • compactionSwitch

      public Map<ServerName,Boolean> compactionSwitch(boolean switchState, List<String> serverNamesList) throws IOException
      Description copied from interface: Admin
      Turn the compaction on or off. Disabling compactions will also interrupt any currently ongoing compactions. This state is ephemeral. The setting will be lost on restart. Compaction can also be enabled/disabled by modifying configuration hbase.regionserver.compaction.enabled in hbase-site.xml.
      Specified by:
      compactionSwitch in interface Admin
      Parameters:
      switchState - Set to true to enable, false to disable.
      serverNamesList - list of region servers.
      Returns:
      Previous compaction states for region servers
      Throws:
      IOException
    • switchCompact

      private Boolean switchCompact(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, boolean onOrOff) throws IOException
      Throws:
      IOException
    • compactRegionServer

      public void compactRegionServer(ServerName serverName) throws IOException
      Description copied from interface: Admin
      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).
      Specified by:
      compactRegionServer in interface Admin
      Parameters:
      serverName - the region server name
      Throws:
      IOException - if a remote or network exception occurs
    • majorCompactRegionServer

      public void majorCompactRegionServer(ServerName serverName) throws IOException
      Description copied from interface: Admin
      Major compact all regions on the region server. Asynchronous operation in that this method requests that a Compaction run and then it returns. It does not wait on the completion of Compaction (it can take a while).
      Specified by:
      majorCompactRegionServer in interface Admin
      Parameters:
      serverName - the region server name
      Throws:
      IOException - if a remote or network exception occurs
    • majorCompact

      public void majorCompact(TableName tableName) throws IOException
      Description copied from interface: Admin
      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).
      Specified by:
      majorCompact in interface Admin
      Parameters:
      tableName - table to major compact
      Throws:
      IOException - if a remote or network exception occurs
    • majorCompactRegion

      public void majorCompactRegion(byte[] regionName) throws IOException
      Description copied from interface: Admin
      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).
      Specified by:
      majorCompactRegion in interface Admin
      Parameters:
      regionName - region to major compact
      Throws:
      IOException - if a remote or network exception occurs
    • majorCompact

      public void majorCompact(TableName tableName, byte[] columnFamily) throws IOException
      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).
      Specified by:
      majorCompact in interface Admin
      Parameters:
      tableName - table to major compact
      columnFamily - column family within a table
      Throws:
      IOException - if a remote or network exception occurs
    • majorCompactRegion

      public void majorCompactRegion(byte[] regionName, byte[] columnFamily) throws IOException
      Description copied from interface: Admin
      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).
      Specified by:
      majorCompactRegion in interface Admin
      Parameters:
      regionName - egion to major compact
      columnFamily - column family within a region
      Throws:
      IOException - if a remote or network exception occurs
    • compact

      private void compact(TableName tableName, byte[] columnFamily, boolean major, CompactType compactType) throws IOException
      Compact a table. Asynchronous operation.
      Parameters:
      tableName - table or region to compact
      columnFamily - column family within a table or region
      major - True if we are to do a major compaction.
      compactType - CompactType
      Throws:
      IOException - if a remote or network exception occurs
    • compactRegion

      private void compactRegion(byte[] regionName, byte[] columnFamily, boolean major) throws IOException
      Compact an individual region. Asynchronous operation.
      Parameters:
      regionName - region to compact
      columnFamily - column family within a table or region
      major - True if we are to do a major compaction.
      Throws:
      IOException - if a remote or network exception occurs
    • compact

      private void compact(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, RegionInfo hri, boolean major, byte[] family) throws IOException
      Throws:
      IOException
    • move

      public void move(byte[] encodedRegionName) throws IOException
      Description copied from interface: Admin
      Move the region encodedRegionName to a random server.
      Specified by:
      move in interface Admin
      Parameters:
      encodedRegionName - The encoded region name; i.e. the hash that makes up the region name suffix: e.g. if regionname is TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396., then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396.
      Throws:
      IOException - if we can't find a region named encodedRegionName
    • move

      public void move(byte[] encodedRegionName, ServerName destServerName) throws IOException
      Description copied from interface: Admin
      Move the region rencodedRegionName to destServerName.
      Specified by:
      move in interface Admin
      Parameters:
      encodedRegionName - The encoded region name; i.e. the hash that makes up the region name suffix: e.g. if regionname is TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396., then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396.
      destServerName - The servername of the destination regionserver. A server name is made of host, port and startcode. Here is an example: host187.example.com,60020,1289493121758
      Throws:
      IOException - if we can't find a region named encodedRegionName
    • assign

      Description copied from interface: Admin
      Assign a Region.
      Specified by:
      assign in interface Admin
      Parameters:
      regionName - Region name to assign.
      Throws:
      IOException - if a remote or network exception occurs
      MasterNotRunningException
      ZooKeeperConnectionException
    • unassign

      public void unassign(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Unassign a Region.
      Specified by:
      unassign in interface Admin
      Parameters:
      regionName - Region name to unassign.
      Throws:
      IOException - if a remote or network exception occurs
    • offline

      public void offline(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Offline specified region from master's in-memory state. It will not attempt to reassign the region as in unassign. This API can be used when a region not served by any region server and still online as per Master's in memory state. If this API is incorrectly used on active region then master will loose track of that region. This is a special method that should be used by experts or hbck.
      Specified by:
      offline in interface Admin
      Parameters:
      regionName - Region to offline.
      Throws:
      IOException - if a remote or network exception occurs
    • balancerSwitch

      public boolean balancerSwitch(boolean on, boolean synchronous) throws IOException
      Description copied from interface: Admin
      Turn the load balancer on or off.
      Specified by:
      balancerSwitch in interface Admin
      Parameters:
      on - Set to true to enable, false to disable.
      synchronous - If true, it waits until current balance() call, if outstanding, to return.
      Returns:
      Previous balancer value
      Throws:
      IOException - if a remote or network exception occurs
    • balance

      Description copied from interface: Admin
      Invoke the balancer with the given balance request. The BalanceRequest defines how the balancer will run. See BalanceRequest for more details.
      Specified by:
      balance in interface Admin
      Parameters:
      request - defines how the balancer should run
      Returns:
      BalanceResponse with details about the results of the invocation.
      Throws:
      IOException - if a remote or network exception occurs
    • isBalancerEnabled

      public boolean isBalancerEnabled() throws IOException
      Description copied from interface: Admin
      Query the current state of the balancer.
      Specified by:
      isBalancerEnabled in interface Admin
      Returns:
      true if the balancer is enabled, false otherwise.
      Throws:
      IOException - if a remote or network exception occurs
    • clearBlockCache

      Clear all the blocks corresponding to this table from BlockCache. For expert-admins. Calling this API will drop all the cached blocks specific to a table from BlockCache. This can significantly impact the query performance as the subsequent queries will have to retrieve the blocks from underlying filesystem.
      Specified by:
      clearBlockCache in interface Admin
      Parameters:
      tableName - table to clear block cache
      Returns:
      CacheEvictionStats related to the eviction
      Throws:
      IOException - if a remote or network exception occurs
    • clearBlockCache

      Throws:
      IOException
    • normalize

      public boolean normalize(NormalizeTableFilterParams ntfp) throws IOException
      Description copied from interface: Admin
      Invoke region normalizer. Can NOT run for various reasons. Check logs. This is a non-blocking invocation to region normalizer. If return value is true, it means the request was submitted successfully. We need to check logs for the details of which regions were split/merged.
      Specified by:
      normalize in interface Admin
      Parameters:
      ntfp - limit to tables matching the specified filter.
      Returns:
      true if region normalizer ran, false otherwise.
      Throws:
      IOException - if a remote or network exception occurs
    • isNormalizerEnabled

      public boolean isNormalizerEnabled() throws IOException
      Description copied from interface: Admin
      Query the current state of the region normalizer.
      Specified by:
      isNormalizerEnabled in interface Admin
      Returns:
      true if region normalizer is enabled, false otherwise.
      Throws:
      IOException - if a remote or network exception occurs
    • normalizerSwitch

      public boolean normalizerSwitch(boolean on) throws IOException
      Description copied from interface: Admin
      Turn region normalizer on or off.
      Specified by:
      normalizerSwitch in interface Admin
      Returns:
      Previous normalizer value
      Throws:
      IOException - if a remote or network exception occurs
    • catalogJanitorSwitch

      public boolean catalogJanitorSwitch(boolean enable) throws IOException
      Description copied from interface: Admin
      Enable/Disable the catalog janitor/
      Specified by:
      catalogJanitorSwitch in interface Admin
      Parameters:
      enable - if true enables the catalog janitor
      Returns:
      the previous state
      Throws:
      IOException - if a remote or network exception occurs
    • runCatalogJanitor

      public int runCatalogJanitor() throws IOException
      Description copied from interface: Admin
      Ask for a scan of the catalog table.
      Specified by:
      runCatalogJanitor in interface Admin
      Returns:
      the number of entries cleaned
      Throws:
      IOException - if a remote or network exception occurs
    • isCatalogJanitorEnabled

      public boolean isCatalogJanitorEnabled() throws IOException
      Description copied from interface: Admin
      Query on the catalog janitor state (Enabled/Disabled?).
      Specified by:
      isCatalogJanitorEnabled in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • cleanerChoreSwitch

      public boolean cleanerChoreSwitch(boolean on) throws IOException
      Description copied from interface: Admin
      Enable/Disable the cleaner chore.
      Specified by:
      cleanerChoreSwitch in interface Admin
      Parameters:
      on - if true enables the cleaner chore
      Returns:
      the previous state
      Throws:
      IOException - if a remote or network exception occurs
    • runCleanerChore

      public boolean runCleanerChore() throws IOException
      Description copied from interface: Admin
      Ask for cleaner chore to run.
      Specified by:
      runCleanerChore in interface Admin
      Returns:
      true if cleaner chore ran, false otherwise
      Throws:
      IOException - if a remote or network exception occurs
    • isCleanerChoreEnabled

      public boolean isCleanerChoreEnabled() throws IOException
      Description copied from interface: Admin
      Query on the cleaner chore state (Enabled/Disabled?).
      Specified by:
      isCleanerChoreEnabled in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • mergeRegionsSync

      public void mergeRegionsSync(byte[] nameOfRegionA, byte[] nameOfRegionB, boolean forcible) throws IOException
      Merge two regions. Synchronous operation. Note: It is not feasible to predict the length of merge. Therefore, this is for internal testing only.
      Parameters:
      nameOfRegionA - encoded or full name of region a
      nameOfRegionB - encoded or full name of region b
      forcible - true if do a compulsory merge, otherwise we will only merge two adjacent regions
      Throws:
      IOException - if a remote or network exception occurs
    • mergeRegions

      @Deprecated public void mergeRegions(byte[] nameOfRegionA, byte[] nameOfRegionB, boolean forcible) throws IOException
      Deprecated.
      Since 2.0. Will be removed in 3.0. Use Admin.mergeRegionsAsync(byte[], byte[], boolean) instead.
      Merge two regions. Asynchronous operation.
      Specified by:
      mergeRegions in interface Admin
      Parameters:
      nameOfRegionA - encoded or full name of region a
      nameOfRegionB - encoded or full name of region b
      forcible - true if do a compulsory merge, otherwise we will only merge two adjacent regions
      Throws:
      IOException - if a remote or network exception occurs
    • mergeRegionsAsync

      public Future<Void> mergeRegionsAsync(byte[][] nameofRegionsToMerge, boolean forcible) throws IOException
      Merge two regions. Asynchronous operation.
      Specified by:
      mergeRegionsAsync in interface Admin
      Parameters:
      nameofRegionsToMerge - encoded or full name of daughter regions
      forcible - true if do a compulsory merge, otherwise we will only merge adjacent regions
      Throws:
      IOException - if a remote or network exception occurs
    • splitRegionSync

      public void splitRegionSync(byte[] regionName, byte[] splitPoint) throws IOException
      Split one region. Synchronous operation. Note: It is not feasible to predict the length of split. Therefore, this is for internal testing only.
      Parameters:
      regionName - encoded or full name of region
      splitPoint - key where region splits
      Throws:
      IOException - if a remote or network exception occurs
    • splitRegionSync

      public void splitRegionSync(byte[] regionName, byte[] splitPoint, long timeout, TimeUnit units) throws IOException
      Split one region. Synchronous operation.
      Parameters:
      regionName - region to be split
      splitPoint - split point
      timeout - how long to wait on split
      units - time units
      Throws:
      IOException - if a remote or network exception occurs
    • splitRegionAsync

      public Future<Void> splitRegionAsync(byte[] regionName, byte[] splitPoint) throws IOException
      Description copied from interface: Admin
      Split an individual region. Asynchronous operation.
      Specified by:
      splitRegionAsync in interface Admin
      Parameters:
      regionName - region to split
      splitPoint - the explicit position to split on
      Throws:
      IOException - if a remote or network exception occurs
    • splitRegionAsync

      Future<Void> splitRegionAsync(RegionInfo hri, byte[] splitPoint) throws IOException
      Throws:
      IOException
    • split

      public void split(TableName tableName) throws IOException
      Description copied from interface: Admin
      Split a table. The method will execute split action for each region in table. Asynchronous operation.
      Specified by:
      split in interface Admin
      Parameters:
      tableName - table to split
      Throws:
      IOException - if a remote or network exception occurs
    • splitRegion

      public void splitRegion(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Split an individual region. Asynchronous operation.
      Specified by:
      splitRegion in interface Admin
      Parameters:
      regionName - region to split
      Throws:
      IOException - if a remote or network exception occurs
    • split

      public void split(TableName tableName, byte[] splitPoint) throws IOException
      Description copied from interface: Admin
      Split a table. Asynchronous operation.
      Specified by:
      split in interface Admin
      Parameters:
      tableName - table to split
      splitPoint - the explicit position to split on
      Throws:
      IOException - if a remote or network exception occurs
    • splitRegion

      public void splitRegion(byte[] regionName, byte[] splitPoint) throws IOException
      Description copied from interface: Admin
      Split an individual region. Asynchronous operation.
      Specified by:
      splitRegion in interface Admin
      Parameters:
      regionName - region to split
      splitPoint - the explicit position to split on
      Throws:
      IOException - if a remote or network exception occurs
    • truncateRegion

      public void truncateRegion(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Truncate an individual region.
      Specified by:
      truncateRegion in interface Admin
      Parameters:
      regionName - region to truncate
      Throws:
      IOException - if a remote or network exception occurs
    • truncateRegionAsync

      public Future<Void> truncateRegionAsync(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Truncate an individual region. Asynchronous operation.
      Specified by:
      truncateRegionAsync in interface Admin
      Parameters:
      regionName - region to truncate
      Throws:
      IOException - if a remote or network exception occurs
    • getCachedFilesList

      public List<String> getCachedFilesList(ServerName serverName) throws IOException
      Get the list of cached files
      Specified by:
      getCachedFilesList in interface Admin
      Throws:
      IOException
    • getTruncateRegionCallable

      private MasterCallable<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.TruncateRegionResponse> getTruncateRegionCallable(TableName tableName, RegionInfo hri)
    • getRegion

      Pair<RegionInfo,ServerName> getRegion(byte[] regionName) throws IOException
      Parameters:
      regionName - Name of a region.
      Returns:
      a pair of HRegionInfo and ServerName if regionName is a verified region name (we call MetaTableAccessor.getRegionLocation(Connection, byte[]) else null. Throw IllegalArgumentException if regionName is null.
      Throws:
      IOException - if a remote or network exception occurs
    • getRegionName

      private byte[] getRegionName(byte[] regionNameOrEncodedRegionName) throws IOException
      If the input is a region name, it is returned as is. If it's an encoded region name, the corresponding region is found from meta and its region name is returned. If we can't find any region in meta matching the input as either region name or encoded region name, the input is returned as is. We don't throw unknown region exception.
      Throws:
      IOException
    • checkTableExists

      private TableName checkTableExists(TableName tableName) throws IOException
      Check if table exists or not
      Parameters:
      tableName - Name of a table.
      Returns:
      tableName instance
      Throws:
      IOException - if a remote or network exception occurs.
      TableNotFoundException - if table does not exist.
    • shutdown

      public void shutdown() throws IOException
      Description copied from interface: Admin
      Shuts down the HBase cluster.

      Notice that, a success shutdown call may ends with an error since the remote server has already been shutdown.

      Specified by:
      shutdown in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • stopMaster

      public void stopMaster() throws IOException
      Description copied from interface: Admin
      Shuts down the current HBase master only. Does not shutdown the cluster.

      Notice that, a success stopMaster call may ends with an error since the remote server has already been shutdown.

      Specified by:
      stopMaster in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
      See Also:
    • stopRegionServer

      public void stopRegionServer(String hostnamePort) throws IOException
      Description copied from interface: Admin
      Stop the designated regionserver.
      Specified by:
      stopRegionServer in interface Admin
      Parameters:
      hostnamePort - Hostname and port delimited by a : as in example.org:1234
      Throws:
      IOException - if a remote or network exception occurs
    • isMasterInMaintenanceMode

      public boolean isMasterInMaintenanceMode() throws IOException
      Description copied from interface: Admin
      Check whether Master is in maintenance mode.
      Specified by:
      isMasterInMaintenanceMode in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • getClusterMetrics

      Description copied from interface: Admin
      Get cluster status with a set of ClusterMetrics.Option to get desired status.
      Specified by:
      getClusterMetrics in interface Admin
      Returns:
      cluster status
      Throws:
      IOException - if a remote or network exception occurs
    • getRegionMetrics

      public List<RegionMetrics> getRegionMetrics(ServerName serverName, TableName tableName) throws IOException
      Description copied from interface: Admin
      Get RegionMetrics of all regions hosted on a regionserver for a table.
      Specified by:
      getRegionMetrics in interface Admin
      Parameters:
      serverName - region server from which RegionMetrics is required.
      tableName - get RegionMetrics of regions belonging to the table
      Returns:
      region metrics map of all regions of a table hosted on a region server
      Throws:
      IOException - if a remote or network exception occurs
    • getConfiguration

      public org.apache.hadoop.conf.Configuration getConfiguration()
      Description copied from interface: Admin
      Returns Configuration used by the instance.
      Specified by:
      getConfiguration in interface Admin
    • get

      private static <T> T get(Future<T> future, long timeout, TimeUnit units) throws IOException
      Do a get with a timeout against the passed in future.
      Throws:
      IOException
    • createNamespaceAsync

      Description copied from interface: Admin
      Create a new namespace.
      Specified by:
      createNamespaceAsync in interface Admin
      Parameters:
      descriptor - descriptor which describes the new namespace
      Returns:
      the result of the async create namespace operation. Use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • modifyNamespaceAsync

      Description copied from interface: Admin
      Modify an existing namespace.
      Specified by:
      modifyNamespaceAsync in interface Admin
      Parameters:
      descriptor - descriptor which describes the new namespace
      Returns:
      the result of the async modify namespace operation. Use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • deleteNamespaceAsync

      Description copied from interface: Admin
      Delete an existing namespace. Only empty namespaces (no tables) can be removed.
      Specified by:
      deleteNamespaceAsync in interface Admin
      Parameters:
      name - namespace name
      Returns:
      the result of the async delete namespace operation. Use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • getNamespaceDescriptor

      Description copied from interface: Admin
      Get a namespace descriptor by name.
      Specified by:
      getNamespaceDescriptor in interface Admin
      Parameters:
      name - name of namespace descriptor
      Returns:
      A descriptor
      Throws:
      NamespaceNotFoundException - if the namespace was not found
      IOException - if a remote or network exception occurs
    • listNamespaces

      public String[] listNamespaces() throws IOException
      List available namespaces
      Specified by:
      listNamespaces in interface Admin
      Returns:
      List of namespace names
      Throws:
      IOException - if a remote or network exception occurs
    • listNamespaceDescriptors

      List available namespace descriptors
      Specified by:
      listNamespaceDescriptors in interface Admin
      Returns:
      List of descriptors
      Throws:
      IOException - if a remote or network exception occurs
    • getProcedures

      public String getProcedures() throws IOException
      Description copied from interface: Admin
      Get procedures.
      Specified by:
      getProcedures in interface Admin
      Returns:
      procedure list in JSON
      Throws:
      IOException - if a remote or network exception occurs
    • getLocks

      public String getLocks() throws IOException
      Description copied from interface: Admin
      Get locks.
      Specified by:
      getLocks in interface Admin
      Returns:
      lock list in JSON
      Throws:
      IOException - if a remote or network exception occurs
    • listTableDescriptorsByNamespace

      Description copied from interface: Admin
      Get list of table descriptors by namespace.
      Specified by:
      listTableDescriptorsByNamespace in interface Admin
      Parameters:
      name - namespace name
      Returns:
      HTD[] the read-only tableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
    • listTableNamesByNamespace

      Description copied from interface: Admin
      Get list of table names by namespace.
      Specified by:
      listTableNamesByNamespace in interface Admin
      Parameters:
      name - namespace name
      Returns:
      The list of table names in the namespace
      Throws:
      IOException - if a remote or network exception occurs
    • available

      public static void available(org.apache.hadoop.conf.Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException
      Is HBase available? Throw an exception if not.
      Parameters:
      conf - system configuration
      Throws:
      MasterNotRunningException - if the master is not running.
      ZooKeeperConnectionException - if unable to connect to zookeeper. // TODO do not expose ZKConnectionException.
      IOException
    • getTableRegions

      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0 Use getRegions(TableName).
      Description copied from interface: Admin
      Get the regions of a given table.
      Specified by:
      getTableRegions in interface Admin
      Parameters:
      tableName - the name of the table
      Returns:
      List of HRegionInfo.
      Throws:
      IOException - if a remote or network exception occurs
    • close

      public void close() throws IOException
      Specified by:
      close in interface Admin
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getTableDescriptorsByTableName

      Description copied from interface: Admin
      Get tableDescriptors.
      Specified by:
      getTableDescriptorsByTableName in interface Admin
      Parameters:
      tableNames - List of table names
      Returns:
      HTD[] the read-only tableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
    • getTableDescriptors

      Description copied from interface: Admin
      Get tableDescriptors.
      Specified by:
      getTableDescriptors in interface Admin
      Parameters:
      names - List of table names
      Returns:
      HTD[] the read-only tableDescriptors
      Throws:
      IOException - if a remote or network exception occurs
    • rollWALWriterImpl

      private org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.RollWALWriterResponse rollWALWriterImpl(ServerName sn) throws IOException, FailedLogCloseException
      Throws:
      IOException
      FailedLogCloseException
    • rollWALWriter

      public void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException
      Description copied from interface: Admin
      Roll the log writer. I.e. for filesystem based write ahead logs, start writing to a new file. Note that the actual rolling of the log writer is asynchronous and may not be complete when this method returns. As a side effect of this call, the named region server may schedule store flushes at the request of the wal.
      Specified by:
      rollWALWriter in interface Admin
      Parameters:
      serverName - The servername of the regionserver.
      Throws:
      IOException - if a remote or network exception occurs
      FailedLogCloseException - if we failed to close the WAL
    • getCompactionState

      Description copied from interface: Admin
      Get the current compaction state of a table. It could be in a major compaction, a minor compaction, both, or none.
      Specified by:
      getCompactionState in interface Admin
      Parameters:
      tableName - table to examine
      Returns:
      the current compaction state
      Throws:
      IOException - if a remote or network exception occurs
    • getCompactionStateForRegion

      public CompactionState getCompactionStateForRegion(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Get the current compaction state of region. It could be in a major compaction, a minor compaction, both, or none.
      Specified by:
      getCompactionStateForRegion in interface Admin
      Parameters:
      regionName - region to examine
      Returns:
      the current compaction state
      Throws:
      IOException - if a remote or network exception occurs
    • snapshotAsync

      Description copied from interface: Admin
      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.
      Specified by:
      snapshotAsync in interface Admin
      Parameters:
      snapshotDesc - snapshot to take
      Throws:
      IOException - if the snapshot did not succeed or we lose contact with the master.
      SnapshotCreationException - if snapshot creation failed
    • asyncSnapshot

      private org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SnapshotResponse asyncSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) throws IOException
      Throws:
      IOException
    • isSnapshotFinished

      Description copied from interface: Admin
      Check the current state of the passed snapshot. There are three possible states:
      1. running - returns false
      2. finished - returns true
      3. finished with error - throws the exception that caused the snapshot to fail
      The cluster only knows about the most recent snapshot. Therefore, if another snapshot has been run/started since the snapshot you are checking, you will receive an UnknownSnapshotException.
      Specified by:
      isSnapshotFinished in interface Admin
      Parameters:
      snapshotDesc - description of the snapshot to check
      Returns:
      true if the snapshot is completed, false if the snapshot is still running
      Throws:
      IOException - if we have a network issue
      HBaseSnapshotException - if the snapshot failed
      UnknownSnapshotException - if the requested snapshot is unknown
    • restoreSnapshot

      public void restoreSnapshot(byte[] snapshotName) throws IOException, RestoreSnapshotException
      Description copied from interface: Admin
      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 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.
      Specified by:
      restoreSnapshot in interface Admin
      Parameters:
      snapshotName - name of the snapshot to restore
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if snapshot failed to be restored
    • restoreSnapshot

      public void restoreSnapshot(String snapshotName) throws IOException, RestoreSnapshotException
      Description copied from interface: Admin
      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 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.
      Specified by:
      restoreSnapshot in interface Admin
      Parameters:
      snapshotName - name of the snapshot to restore
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if snapshot failed to be restored
    • restoreSnapshot

      public void restoreSnapshot(byte[] snapshotName, boolean takeFailSafeSnapshot) throws IOException, RestoreSnapshotException
      Description copied from interface: Admin
      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 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".
      Specified by:
      restoreSnapshot in interface Admin
      Parameters:
      snapshotName - name of the snapshot to restore
      takeFailSafeSnapshot - true if the failsafe snapshot should be taken
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if snapshot failed to be restored
    • getTableNameBeforeRestoreSnapshot

      Check whether the snapshot exists and contains disabled table
      Parameters:
      snapshotName - name of the snapshot to restore
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if no valid snapshot is found
    • restoreSnapshot

      public void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot) throws IOException, RestoreSnapshotException
      Description copied from interface: Admin
      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 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".
      Specified by:
      restoreSnapshot in interface Admin
      Parameters:
      snapshotName - name of the snapshot to restore
      takeFailSafeSnapshot - true if the failsafe snapshot should be taken
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if snapshot failed to be restored
    • restoreSnapshot

      public void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot, boolean restoreAcl) throws IOException, RestoreSnapshotException
      Description copied from interface: Admin
      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 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".
      Specified by:
      restoreSnapshot in interface Admin
      Parameters:
      snapshotName - name of the snapshot to restore
      takeFailSafeSnapshot - true if the failsafe snapshot should be taken
      restoreAcl - true to restore acl of snapshot
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if snapshot failed to be restored
    • restoreSnapshotAsync

      Description copied from interface: Admin
      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 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.
      Specified by:
      restoreSnapshotAsync in interface Admin
      Parameters:
      snapshotName - name of the snapshot to restore
      Returns:
      the result of the async restore snapshot. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if snapshot failed to be restored
    • cloneSnapshotAsync

      public Future<Void> cloneSnapshotAsync(String snapshotName, TableName tableName, boolean restoreAcl, String customSFT) throws IOException, TableExistsException, RestoreSnapshotException
      Description copied from interface: Admin
      Create a new table by cloning the snapshot content.
      Specified by:
      cloneSnapshotAsync in interface Admin
      Parameters:
      snapshotName - name of the snapshot to be cloned
      tableName - name of the table where the snapshot will be restored
      restoreAcl - true to clone acl into newly created table
      customSFT - specify the StroreFileTracker used for the table
      Throws:
      IOException - if a remote or network exception occurs
      TableExistsException - if table to be created already exists
      RestoreSnapshotException - if snapshot failed to be cloned
    • execProcedureWithReturn

      public byte[] execProcedureWithReturn(String signature, String instance, Map<String,String> props) throws IOException
      Description copied from interface: Admin
      Execute a distributed procedure on a cluster.
      Specified by:
      execProcedureWithReturn in interface Admin
      Parameters:
      signature - A distributed procedure is uniquely identified by its signature (default the root ZK node name of the procedure).
      instance - The instance name of the procedure. For some procedures, this parameter is optional.
      props - Property/Value pairs of properties passing to the procedure
      Returns:
      data returned after procedure execution. null if no return data.
      Throws:
      IOException - if a remote or network exception occurs
    • execProcedure

      public void execProcedure(String signature, String instance, Map<String,String> props) throws IOException
      Description copied from interface: Admin
      Execute a distributed procedure on a cluster.
      Specified by:
      execProcedure in interface Admin
      Parameters:
      signature - A distributed procedure is uniquely identified by its signature (default the root ZK node name of the procedure).
      instance - The instance name of the procedure. For some procedures, this parameter is optional.
      props - Property/Value pairs of properties passing to the procedure
      Throws:
      IOException - if a remote or network exception occurs
    • isProcedureFinished

      public boolean isProcedureFinished(String signature, String instance, Map<String,String> props) throws IOException
      Description copied from interface: Admin
      Check the current state of the specified procedure. There are three possible states:
      1. running - returns false
      2. finished - returns true
      3. finished with error - throws the exception that caused the procedure to fail
      Specified by:
      isProcedureFinished in interface Admin
      Parameters:
      signature - The signature that uniquely identifies a procedure
      instance - The instance name of the procedure
      props - Property/Value pairs of properties passing to the procedure
      Returns:
      true if the specified procedure is finished successfully, false if it is still running
      Throws:
      IOException - if the specified procedure finished with error
    • internalRestoreSnapshotAsync

      private Future<Void> internalRestoreSnapshotAsync(String snapshotName, TableName tableName, boolean restoreAcl, String customSFT) throws IOException, RestoreSnapshotException
      Execute Restore/Clone snapshot and wait for the server to complete (blocking). To check if the cloned table exists, use isTableAvailable(org.apache.hadoop.hbase.TableName) -- it is not safe to create an HTable instance to this table before it is available.
      Parameters:
      snapshotName - snapshot to restore
      tableName - table name to restore the snapshot on
      Throws:
      IOException - if a remote or network exception occurs
      RestoreSnapshotException - if snapshot failed to be restored
      IllegalArgumentException - if the restore request is formatted incorrectly
    • listSnapshots

      Description copied from interface: Admin
      List completed snapshots.
      Specified by:
      listSnapshots in interface Admin
      Returns:
      a list of snapshot descriptors for completed snapshots
      Throws:
      IOException - if a network error occurs
    • listSnapshots

      Description copied from interface: Admin
      List all the completed snapshots matching the given regular expression.
      Specified by:
      listSnapshots in interface Admin
      Parameters:
      regex - The regular expression to match against
      Returns:
      list of SnapshotDescription
      Throws:
      IOException - if a remote or network exception occurs
    • listSnapshots

      Description copied from interface: Admin
      List all the completed snapshots matching the given pattern.
      Specified by:
      listSnapshots in interface Admin
      Parameters:
      pattern - The compiled regular expression to match against
      Returns:
      list of SnapshotDescription
      Throws:
      IOException - if a remote or network exception occurs
    • listTableSnapshots

      public List<SnapshotDescription> listTableSnapshots(String tableNameRegex, String snapshotNameRegex) throws IOException
      Description copied from interface: Admin
      List all the completed snapshots matching the given table name regular expression and snapshot name regular expression.
      Specified by:
      listTableSnapshots in interface Admin
      Parameters:
      tableNameRegex - The table name regular expression to match against
      snapshotNameRegex - The snapshot name regular expression to match against
      Returns:
      list of completed SnapshotDescription
      Throws:
      IOException - if a remote or network exception occurs
    • listTableSnapshots

      public List<SnapshotDescription> listTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern) throws IOException
      Description copied from interface: Admin
      List all the completed snapshots matching the given table name regular expression and snapshot name regular expression.
      Specified by:
      listTableSnapshots in interface Admin
      Parameters:
      tableNamePattern - The compiled table name regular expression to match against
      snapshotNamePattern - The compiled snapshot name regular expression to match against
      Returns:
      list of completed SnapshotDescription
      Throws:
      IOException - if a remote or network exception occurs
    • deleteSnapshot

      public void deleteSnapshot(byte[] snapshotName) throws IOException
      Description copied from interface: Admin
      Delete an existing snapshot.
      Specified by:
      deleteSnapshot in interface Admin
      Parameters:
      snapshotName - name of the snapshot
      Throws:
      IOException - if a remote or network exception occurs
    • deleteSnapshot

      public void deleteSnapshot(String snapshotName) throws IOException
      Description copied from interface: Admin
      Delete an existing snapshot.
      Specified by:
      deleteSnapshot in interface Admin
      Parameters:
      snapshotName - name of the snapshot
      Throws:
      IOException - if a remote or network exception occurs
    • deleteSnapshots

      public void deleteSnapshots(String regex) throws IOException
      Description copied from interface: Admin
      Delete existing snapshots whose names match the pattern passed.
      Specified by:
      deleteSnapshots in interface Admin
      Parameters:
      regex - The regular expression to match against
      Throws:
      IOException - if a remote or network exception occurs
    • deleteSnapshots

      public void deleteSnapshots(Pattern pattern) throws IOException
      Description copied from interface: Admin
      Delete existing snapshots whose names match the pattern passed.
      Specified by:
      deleteSnapshots in interface Admin
      Parameters:
      pattern - pattern for names of the snapshot to match
      Throws:
      IOException - if a remote or network exception occurs
    • internalDeleteSnapshot

      private void internalDeleteSnapshot(SnapshotDescription snapshot) throws IOException
      Throws:
      IOException
    • deleteTableSnapshots

      public void deleteTableSnapshots(String tableNameRegex, String snapshotNameRegex) throws IOException
      Description copied from interface: Admin
      Delete all existing snapshots matching the given table name regular expression and snapshot name regular expression.
      Specified by:
      deleteTableSnapshots in interface Admin
      Parameters:
      tableNameRegex - The table name regular expression to match against
      snapshotNameRegex - The snapshot name regular expression to match against
      Throws:
      IOException - if a remote or network exception occurs
    • deleteTableSnapshots

      public void deleteTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern) throws IOException
      Description copied from interface: Admin
      Delete all existing snapshots matching the given table name regular expression and snapshot name regular expression.
      Specified by:
      deleteTableSnapshots in interface Admin
      Parameters:
      tableNamePattern - The compiled table name regular expression to match against
      snapshotNamePattern - The compiled snapshot name regular expression to match against
      Throws:
      IOException - if a remote or network exception occurs
    • setQuota

      public void setQuota(QuotaSettings quota) throws IOException
      Description copied from interface: Admin
      Apply the new quota settings.
      Specified by:
      setQuota in interface Admin
      Parameters:
      quota - the quota settings
      Throws:
      IOException - if a remote or network exception occurs
    • getQuotaRetriever

      Description copied from interface: Admin
      Return a QuotaRetriever to list the quotas based on the filter.
      Specified by:
      getQuotaRetriever in interface Admin
      Parameters:
      filter - the quota settings filter
      Returns:
      the quota retriever
      Throws:
      IOException - if a remote or network exception occurs
    • getQuota

      Description copied from interface: Admin
      List the quotas based on the filter.
      Specified by:
      getQuota in interface Admin
      Parameters:
      filter - the quota settings filter
      Returns:
      the QuotaSetting list
      Throws:
      IOException - if a remote or network exception occurs
    • executeCallable

      private <C extends RetryingCallable<V> & Closeable, V> V executeCallable(C callable) throws IOException
      Throws:
      IOException
    • executeCallable

      private static <C extends RetryingCallable<V> & Closeable, V> V executeCallable(C callable, RpcRetryingCallerFactory rpcCallerFactory, int operationTimeout, int rpcTimeout) throws IOException
      Throws:
      IOException
    • coprocessorService

      Description copied from interface: Admin
      Creates and returns a RpcChannel instance connected to the active master.

      The obtained RpcChannel instance can be used to access a published coprocessor Service using standard protobuf service invocations:

       CoprocessorRpcChannel channel = myAdmin.coprocessorService();
       MyService.BlockingInterface service = MyService.newBlockingStub(channel);
       MyCallRequest request = MyCallRequest.newBuilder()
           ...
           .build();
       MyCallResponse response = service.myCall(null, request);
       
      Specified by:
      coprocessorService in interface Admin
      Returns:
      A MasterCoprocessorRpcChannel instance
    • coprocessorService

      Description copied from interface: Admin
      Creates and returns a RpcChannel instance connected to the passed region server.

      The obtained RpcChannel instance can be used to access a published coprocessor Service using standard protobuf service invocations:

       CoprocessorRpcChannel channel = myAdmin.coprocessorService(serverName);
       MyService.BlockingInterface service = MyService.newBlockingStub(channel);
       MyCallRequest request = MyCallRequest.newBuilder()
           ...
           .build();
       MyCallResponse response = service.myCall(null, request);
       
      Specified by:
      coprocessorService in interface Admin
      Parameters:
      serverName - the server name to which the endpoint call is made
      Returns:
      A RegionServerCoprocessorRpcChannel instance
    • updateConfiguration

      public void updateConfiguration(ServerName server) throws IOException
      Description copied from interface: Admin
      Update the configuration and trigger an online config change on the regionserver.
      Specified by:
      updateConfiguration in interface Admin
      Parameters:
      server - : The server whose config needs to be updated.
      Throws:
      IOException - if a remote or network exception occurs
    • updateConfiguration

      public void updateConfiguration() throws IOException
      Description copied from interface: Admin
      Update the configuration and trigger an online config change on all the regionservers.
      Specified by:
      updateConfiguration in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • getLastMajorCompactionTimestamp

      public long getLastMajorCompactionTimestamp(TableName tableName) throws IOException
      Description copied from interface: Admin
      Get the timestamp of the last major compaction for the passed table The timestamp of the oldest HFile resulting from a major compaction of that table, or 0 if no such HFile could be found.
      Specified by:
      getLastMajorCompactionTimestamp in interface Admin
      Parameters:
      tableName - table to examine
      Returns:
      the last major compaction timestamp or 0
      Throws:
      IOException - if a remote or network exception occurs
    • getLastMajorCompactionTimestampForRegion

      public long getLastMajorCompactionTimestampForRegion(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Get the timestamp of the last major compaction for the passed region. The timestamp of the oldest HFile resulting from a major compaction of that region, or 0 if no such HFile could be found.
      Specified by:
      getLastMajorCompactionTimestampForRegion in interface Admin
      Parameters:
      regionName - region to examine
      Returns:
      the last major compaction timestamp or 0
      Throws:
      IOException - if a remote or network exception occurs
    • compact

      public void compact(TableName tableName, byte[] columnFamily, CompactType compactType) throws IOException, InterruptedException
      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).
      Specified by:
      compact in interface Admin
      Parameters:
      tableName - table to compact
      columnFamily - column family within a table
      compactType - CompactType
      Throws:
      IOException - if not a mob column family or if a remote or network exception occurs
      InterruptedException
    • compact

      public void compact(TableName tableName, CompactType compactType) throws IOException, InterruptedException
      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).
      Specified by:
      compact in interface Admin
      Parameters:
      tableName - table to compact
      compactType - CompactType
      Throws:
      IOException - if a remote or network exception occurs
      InterruptedException
    • majorCompact

      public void majorCompact(TableName tableName, byte[] columnFamily, CompactType compactType) throws IOException, InterruptedException
      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).
      Specified by:
      majorCompact in interface Admin
      Parameters:
      tableName - table to compact
      columnFamily - column family within a table
      compactType - CompactType
      Throws:
      IOException - if not a mob column family or if a remote or network exception occurs
      InterruptedException
    • majorCompact

      public void majorCompact(TableName tableName, CompactType compactType) throws IOException, InterruptedException
      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).
      Specified by:
      majorCompact in interface Admin
      Parameters:
      tableName - table to compact
      compactType - CompactType
      Throws:
      IOException - if a remote or network exception occurs
      InterruptedException
    • getCompactionState

      public CompactionState getCompactionState(TableName tableName, CompactType compactType) throws IOException
      Get the current compaction state of a table. It could be in a compaction, or none.
      Specified by:
      getCompactionState in interface Admin
      Parameters:
      tableName - table to examine
      compactType - CompactType
      Returns:
      the current compaction state
      Throws:
      IOException - if a remote or network exception occurs
    • getSecurityCapabilities

      Description copied from interface: Admin
      Return the set of supported security capabilities.
      Specified by:
      getSecurityCapabilities in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • splitSwitch

      public boolean splitSwitch(boolean enabled, boolean synchronous) throws IOException
      Description copied from interface: Admin
      Turn the split switch on or off.
      Specified by:
      splitSwitch in interface Admin
      Parameters:
      enabled - enabled or not
      synchronous - If true, it waits until current split() call, if outstanding, to return.
      Returns:
      Previous switch value
      Throws:
      IOException - if a remote or network exception occurs
    • mergeSwitch

      public boolean mergeSwitch(boolean enabled, boolean synchronous) throws IOException
      Description copied from interface: Admin
      Turn the merge switch on or off.
      Specified by:
      mergeSwitch in interface Admin
      Parameters:
      enabled - enabled or not
      synchronous - If true, it waits until current merge() call, if outstanding, to return.
      Returns:
      Previous switch value
      Throws:
      IOException - if a remote or network exception occurs
    • splitOrMergeSwitch

      private boolean splitOrMergeSwitch(boolean enabled, boolean synchronous, MasterSwitchType switchType) throws IOException
      Throws:
      IOException
    • isSplitEnabled

      public boolean isSplitEnabled() throws IOException
      Description copied from interface: Admin
      Query the current state of the split switch.
      Specified by:
      isSplitEnabled in interface Admin
      Returns:
      true if the switch is enabled, false otherwise.
      Throws:
      IOException - if a remote or network exception occurs
    • isMergeEnabled

      public boolean isMergeEnabled() throws IOException
      Description copied from interface: Admin
      Query the current state of the merge switch.
      Specified by:
      isMergeEnabled in interface Admin
      Returns:
      true if the switch is enabled, false otherwise.
      Throws:
      IOException - if a remote or network exception occurs
    • getRpcControllerFactory

    • addReplicationPeerAsync

      public Future<Void> addReplicationPeerAsync(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) throws IOException
      Description copied from interface: Admin
      Add a new replication peer but does not block and wait for it.

      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.

      Specified by:
      addReplicationPeerAsync in interface Admin
      Parameters:
      peerId - a short name that identifies the peer
      peerConfig - configuration for the replication peer
      enabled - peer state, true if ENABLED and false if DISABLED
      Returns:
      the result of the async operation
      Throws:
      IOException - IOException if a remote or network exception occurs
    • removeReplicationPeerAsync

      Description copied from interface: Admin
      Remove a replication peer but does not block and wait for it.

      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.

      Specified by:
      removeReplicationPeerAsync in interface Admin
      Parameters:
      peerId - a short name that identifies the peer
      Returns:
      the result of the async operation
      Throws:
      IOException - IOException if a remote or network exception occurs
    • enableReplicationPeerAsync

      Description copied from interface: Admin
      Enable a replication peer but does not block and wait for it.

      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.

      Specified by:
      enableReplicationPeerAsync in interface Admin
      Parameters:
      peerId - a short name that identifies the peer
      Returns:
      the result of the async operation
      Throws:
      IOException - IOException if a remote or network exception occurs
    • disableReplicationPeerAsync

      Description copied from interface: Admin
      Disable a replication peer but does not block and wait for it.

      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.

      Specified by:
      disableReplicationPeerAsync in interface Admin
      Parameters:
      peerId - a short name that identifies the peer
      Returns:
      the result of the async operation
      Throws:
      IOException - IOException if a remote or network exception occurs
    • getReplicationPeerConfig

      Description copied from interface: Admin
      Returns the configured ReplicationPeerConfig for the specified peer.
      Specified by:
      getReplicationPeerConfig in interface Admin
      Parameters:
      peerId - a short name that identifies the peer
      Returns:
      ReplicationPeerConfig for the peer
      Throws:
      IOException - if a remote or network exception occurs
    • updateReplicationPeerConfigAsync

      Description copied from interface: Admin
      Update the peerConfig for the specified peer but does not block and wait for it.

      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.

      Specified by:
      updateReplicationPeerConfigAsync in interface Admin
      Parameters:
      peerId - a short name that identifies the peer
      peerConfig - new config for the replication peer
      Returns:
      the result of the async operation
      Throws:
      IOException - IOException if a remote or network exception occurs
    • listReplicationPeers

      Description copied from interface: Admin
      Return a list of replication peers.
      Specified by:
      listReplicationPeers in interface Admin
      Returns:
      a list of replication peers description
      Throws:
      IOException - if a remote or network exception occurs
    • listReplicationPeers

      Description copied from interface: Admin
      Return a list of replication peers.
      Specified by:
      listReplicationPeers in interface Admin
      Parameters:
      pattern - The compiled regular expression to match peer id
      Returns:
      a list of replication peers description
      Throws:
      IOException - if a remote or network exception occurs
    • decommissionRegionServers

      public void decommissionRegionServers(List<ServerName> servers, boolean offload) throws IOException
      Description copied from interface: Admin
      Mark region server(s) as decommissioned to prevent additional regions from getting assigned to them. Optionally unload the regions on the servers. If there are multiple servers to be decommissioned, decommissioning them at the same time can prevent wasteful region movements. Region unloading is asynchronous.
      Specified by:
      decommissionRegionServers in interface Admin
      Parameters:
      servers - The list of servers to decommission.
      offload - True to offload the regions from the decommissioned servers
      Throws:
      IOException - if a remote or network exception occurs
    • listDecommissionedRegionServers

      Description copied from interface: Admin
      List region servers marked as decommissioned, which can not be assigned regions.
      Specified by:
      listDecommissionedRegionServers in interface Admin
      Returns:
      List of decommissioned region servers.
      Throws:
      IOException - if a remote or network exception occurs
    • recommissionRegionServer

      public void recommissionRegionServer(ServerName server, List<byte[]> encodedRegionNames) throws IOException
      Description copied from interface: Admin
      Remove decommission marker from a region server to allow regions assignments. Load regions onto the server if a list of regions is given. Region loading is asynchronous.
      Specified by:
      recommissionRegionServer in interface Admin
      Parameters:
      server - The server to recommission.
      encodedRegionNames - Regions to load onto the server.
      Throws:
      IOException - if a remote or network exception occurs
    • listReplicatedTableCFs

      Description copied from interface: Admin
      Find all table and column families that are replicated from this cluster
      Specified by:
      listReplicatedTableCFs in interface Admin
      Returns:
      the replicated table-cfs list of this cluster.
      Throws:
      IOException - if a remote or network exception occurs
    • enableTableReplication

      public void enableTableReplication(TableName tableName) throws IOException
      Description copied from interface: Admin
      Enable a table's replication switch.
      Specified by:
      enableTableReplication in interface Admin
      Parameters:
      tableName - name of the table
      Throws:
      IOException - if a remote or network exception occurs
    • disableTableReplication

      public void disableTableReplication(TableName tableName) throws IOException
      Description copied from interface: Admin
      Disable a table's replication switch.
      Specified by:
      disableTableReplication in interface Admin
      Parameters:
      tableName - name of the table
      Throws:
      IOException - if a remote or network exception occurs
    • isReplicationPeerEnabled

      public boolean isReplicationPeerEnabled(String peerId) throws IOException
      Description copied from interface: Admin
      Check if a replication peer is enabled.
      Specified by:
      isReplicationPeerEnabled in interface Admin
      Parameters:
      peerId - id of replication peer to check
      Returns:
      true if replication peer is enabled
      Throws:
      IOException - if a remote or network exception occurs
    • checkAndSyncTableDescToPeers

      private void checkAndSyncTableDescToPeers(TableName tableName, byte[][] splits) throws IOException
      Connect to peer and check the table descriptor on peer:
      1. Create the same table on peer when not exist.
      2. Throw an exception if the table already has replication enabled on any of the column families.
      3. Throw an exception if the table exists on peer cluster but descriptors are not same.
      Parameters:
      tableName - name of the table to sync to the peer
      splits - table split keys
      Throws:
      IOException - if a remote or network exception occurs
    • setTableRep

      private void setTableRep(TableName tableName, boolean enableRep) throws IOException
      Set the table's replication switch if the table's replication switch is already not set.
      Parameters:
      tableName - name of the table
      enableRep - is replication switch enable or disable
      Throws:
      IOException - if a remote or network exception occurs
    • clearCompactionQueues

      Description copied from interface: Admin
      Clear compacting queues on a regionserver.
      Specified by:
      clearCompactionQueues in interface Admin
      Parameters:
      sn - the region server name
      queues - the set of queue name
      Throws:
      IOException - if a remote or network exception occurs
      InterruptedException
    • clearDeadServers

      Description copied from interface: Admin
      Clear dead region servers from master.
      Specified by:
      clearDeadServers in interface Admin
      Parameters:
      servers - list of dead region servers.
      Returns:
      List of servers that are not cleared
      Throws:
      IOException - if a remote or network exception occurs
    • cloneTableSchema

      public void cloneTableSchema(TableName tableName, TableName newTableName, boolean preserveSplits) throws IOException
      Description copied from interface: Admin
      Create a new table by cloning the existent table schema.
      Specified by:
      cloneTableSchema in interface Admin
      Parameters:
      tableName - name of the table to be cloned
      newTableName - name of the new table where the table will be created
      preserveSplits - True if the splits should be preserved
      Throws:
      IOException - if a remote or network exception occurs
    • switchRpcThrottle

      public boolean switchRpcThrottle(boolean enable) throws IOException
      Description copied from interface: Admin
      Switch the rpc throttle enable state.
      Specified by:
      switchRpcThrottle in interface Admin
      Parameters:
      enable - Set to true to enable, false to disable.
      Returns:
      Previous rpc throttle enabled value
      Throws:
      IOException - if a remote or network exception occurs
    • isRpcThrottleEnabled

      public boolean isRpcThrottleEnabled() throws IOException
      Description copied from interface: Admin
      Get if the rpc throttle is enabled.
      Specified by:
      isRpcThrottleEnabled in interface Admin
      Returns:
      True if rpc throttle is enabled
      Throws:
      IOException - if a remote or network exception occurs
    • exceedThrottleQuotaSwitch

      public boolean exceedThrottleQuotaSwitch(boolean enable) throws IOException
      Description copied from interface: Admin
      Switch the exceed throttle quota. If enabled, user/table/namespace throttle quota can be exceeded if region server has availble quota.
      Specified by:
      exceedThrottleQuotaSwitch in interface Admin
      Parameters:
      enable - Set to true to enable, false to disable.
      Returns:
      Previous exceed throttle enabled value
      Throws:
      IOException - if a remote or network exception occurs
    • getSpaceQuotaTableSizes

      Description copied from interface: Admin
      Fetches the table sizes on the filesystem as tracked by the HBase Master.
      Specified by:
      getSpaceQuotaTableSizes in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • getRegionServerSpaceQuotaSnapshots

      Description copied from interface: Admin
      Fetches the observed SpaceQuotaSnapshotViews observed by a RegionServer.
      Specified by:
      getRegionServerSpaceQuotaSnapshots in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • getCurrentSpaceQuotaSnapshot

      Description copied from interface: Admin
      Returns the Master's view of a quota on the given namespace or null if the Master has no quota information on that namespace.
      Specified by:
      getCurrentSpaceQuotaSnapshot in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • getCurrentSpaceQuotaSnapshot

      Description copied from interface: Admin
      Returns the Master's view of a quota on the given tableName or null if the Master has no quota information on that table.
      Specified by:
      getCurrentSpaceQuotaSnapshot in interface Admin
      Throws:
      IOException - if a remote or network exception occurs
    • grant

      public void grant(UserPermission userPermission, boolean mergeExistingPermissions) throws IOException
      Description copied from interface: Admin
      Grants user specific permissions
      Specified by:
      grant in interface Admin
      Parameters:
      userPermission - user name and the specific permission
      mergeExistingPermissions - If set to false, later granted permissions will override previous granted permissions. otherwise, it'll merge with previous granted permissions.
      Throws:
      IOException - if a remote or network exception occurs
    • revoke

      public void revoke(UserPermission userPermission) throws IOException
      Description copied from interface: Admin
      Revokes user specific permissions
      Specified by:
      revoke in interface Admin
      Parameters:
      userPermission - user name and the specific permission
      Throws:
      IOException - if a remote or network exception occurs
    • getUserPermissions

      public List<UserPermission> getUserPermissions(GetUserPermissionsRequest getUserPermissionsRequest) throws IOException
      Description copied from interface: Admin
      Get the global/namespace/table permissions for user
      Specified by:
      getUserPermissions in interface Admin
      Parameters:
      getUserPermissionsRequest - A request contains which user, global, namespace or table permissions needed
      Returns:
      The user and permission list
      Throws:
      IOException - if a remote or network exception occurs
    • splitRegionAsync

      public Future<Void> splitRegionAsync(byte[] regionName) throws IOException
      Description copied from interface: Admin
      Split an individual region. Asynchronous operation.
      Specified by:
      splitRegionAsync in interface Admin
      Parameters:
      regionName - region to split
      Throws:
      IOException - if a remote or network exception occurs
    • createTableAsync

      Description copied from interface: Admin
      Creates a new table but does not block and wait for it to come online. 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.

      Throws IllegalArgumentException Bad table name, if the split keys are repeated and if the split key has empty byte array.

      Specified by:
      createTableAsync in interface Admin
      Parameters:
      desc - table descriptor for table
      Returns:
      the result of the async creation. You can use Future.get(long, TimeUnit) to wait on the operation to complete.
      Throws:
      IOException - if a remote or network exception occurs
    • hasUserPermissions

      public List<Boolean> hasUserPermissions(String userName, List<Permission> permissions) throws IOException
      Description copied from interface: Admin
      Check if the user has specific permissions
      Specified by:
      hasUserPermissions in interface Admin
      Parameters:
      userName - the user name
      permissions - the specific permission list
      Returns:
      True if user has the specific permissions
      Throws:
      IOException - if a remote or network exception occurs
    • snapshotCleanupSwitch

      public boolean snapshotCleanupSwitch(boolean on, boolean synchronous) throws IOException
      Description copied from interface: Admin
      Turn on or off the auto snapshot cleanup based on TTL.
      Specified by:
      snapshotCleanupSwitch in interface Admin
      Parameters:
      on - Set to true to enable, false to disable.
      synchronous - If true, it waits until current snapshot cleanup is completed, if outstanding.
      Returns:
      Previous auto snapshot cleanup value
      Throws:
      IOException - if a remote or network exception occurs
    • isSnapshotCleanupEnabled

      public boolean isSnapshotCleanupEnabled() throws IOException
      Description copied from interface: Admin
      Query the current state of the auto snapshot cleanup based on TTL.
      Specified by:
      isSnapshotCleanupEnabled in interface Admin
      Returns:
      true if the auto snapshot cleanup is enabled, false otherwise.
      Throws:
      IOException - if a remote or network exception occurs
    • getSlowLogResponses

      private List<LogEntry> getSlowLogResponses(Map<String,Object> filterParams, Set<ServerName> serverNames, int limit, String logType)
    • getSlowLogResponseFromServer

      private List<LogEntry> getSlowLogResponseFromServer(ServerName serverName, Map<String,Object> filterParams, int limit, String logType) throws IOException
      Throws:
      IOException
    • clearSlowLogResponses

      public List<Boolean> clearSlowLogResponses(@Nullable Set<ServerName> serverNames) throws IOException
      Description copied from interface: Admin
      Clears online slow/large RPC logs from the provided list of RegionServers
      Specified by:
      clearSlowLogResponses in interface Admin
      Parameters:
      serverNames - Set of Server names to clean slowlog responses from
      Returns:
      List of booleans representing if online slowlog response buffer is cleaned from each RegionServer
      Throws:
      IOException - if a remote or network exception occurs
    • getLogEntries

      public List<LogEntry> getLogEntries(Set<ServerName> serverNames, String logType, ServerType serverType, int limit, Map<String,Object> filterParams) throws IOException
      Description copied from interface: Admin
      Retrieve recent online records from HMaster / RegionServers. Examples include slow/large RPC logs, balancer decisions by master.
      Specified by:
      getLogEntries in interface Admin
      Parameters:
      serverNames - servers to retrieve records from, useful in case of records maintained by RegionServer as we can select specific server. In case of servertype=MASTER, logs will only come from the currently active master.
      logType - string representing type of log records
      serverType - enum for server type: HMaster or RegionServer
      limit - put a limit to list of records that server should send in response
      filterParams - additional filter params
      Returns:
      Log entries representing online records from servers
      Throws:
      IOException - if a remote or network exception occurs
    • flushMasterStore

      public void flushMasterStore() throws IOException
      Description copied from interface: Admin
      Flush master local region
      Specified by:
      flushMasterStore in interface Admin
      Throws:
      IOException
    • getBalancerDecisions

      private List<LogEntry> getBalancerDecisions(int limit) throws IOException
      Throws:
      IOException
    • getBalancerRejections

      private List<LogEntry> getBalancerRejections(int limit) throws IOException
      Throws:
      IOException
    • clearSlowLogsResponses

      Throws:
      IOException
    • replicationPeerModificationSwitch

      public boolean replicationPeerModificationSwitch(boolean on, boolean drainProcedures) throws IOException
      Description copied from interface: Admin
      Enable or disable replication peer modification.

      This is especially useful when you want to change the replication peer storage.

      Specified by:
      replicationPeerModificationSwitch in interface Admin
      Parameters:
      on - true means enable, otherwise disable
      drainProcedures - if true, will wait until all the running replication peer modification procedures finish
      Returns:
      the previous enable/disable state
      Throws:
      IOException
    • isReplicationPeerModificationEnabled

      Description copied from interface: Admin
      Check whether replication peer modification is enabled.
      Specified by:
      isReplicationPeerModificationEnabled in interface Admin
      Returns:
      true if modification is enabled, otherwise false
      Throws:
      IOException