Class HBaseAdminImpl

  • All Implemented Interfaces:
    MapRDBConstants, com.mapr.fs.jni.MapRConstants, java.io.Closeable, java.lang.AutoCloseable

    public class HBaseAdminImpl
    extends org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
    implements MapRDBConstants
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.mapr.fs.jni.MapRConstants

        com.mapr.fs.jni.MapRConstants.ErrorValue, com.mapr.fs.jni.MapRConstants.JniUsername, com.mapr.fs.jni.MapRConstants.PutConstants, com.mapr.fs.jni.MapRConstants.RowConstants
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String FIRST_JSON_COL_FAMILY  
      static int MaxTableCreateRetryCount  
      • Fields inherited from interface com.mapr.fs.jni.MapRConstants

        AtimeBit, AuditBit, ChunkSizeBit, ClusterConfDefault, CompressBit, CompressorTypeBit, DEFAULT_USER_IDENTIFIER, DEFAULT_USER_IDENTIFIER_ESCAPED, DefaultChunkSize, DefaultCLDBIp, DefaultCLDBPort, DiskFlushBit, EMPTY_BYTE_ARRAY, EMPTY_END_ROW, EMPTY_START_ROW, FidNameBit, GroupBit, HADOOP_MAX_BLOCKSIZE, HADOOP_SECURITY_SPOOFED_GID, HADOOP_SECURITY_SPOOFED_GROUP, HADOOP_SECURITY_SPOOFED_UID, HADOOP_SECURITY_SPOOFED_USER, HOSTNAME_IP_SEPARATOR, IP_PORT_SEPARATOR, LAST_ROW, LATEST_TIMESTAMP, MAPR_ENV_VAR, MAPR_PROPERTY_HOME, MapRClusterDir, MapRClusterDirPattern, MapRClusterDirSlash, MAPRFS_PREFIX, MAPRFS_SCHEME, MapRHomeDefault, MAX_CLUSTERS_CROSSED, MAX_PATH_LENGTH, MAX_PORT_NUMBER, MAX_RA_THREADS, MIN_RA_THREADS, MinChunkSize, ModeBit, MtimeBit, MULTI_ADDR_SEPARATOR, NUM_CONTAINERS_PER_RPC, OLDEST_TIMESTAMP, RA_THREADS_PER_STREAM, ReplBit, UserBit, UTF8_ENCODING, WireSecureBit
    • Constructor Summary

      Constructors 
      Constructor Description
      HBaseAdminImpl​(org.apache.hadoop.conf.Configuration c, org.apache.hadoop.hbase.client.mapr.BaseTableMappingRules tableMappingRule)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addColumn​(java.lang.String tableName, org.apache.hadoop.hbase.HColumnDescriptor cf)  
      void addColumn​(org.apache.hadoop.fs.Path tablePath, org.apache.hadoop.hbase.HColumnDescriptor cf)  
      protected com.mapr.fs.tables.MapRAdmin admin()  
      protected void checkTable​(org.apache.hadoop.fs.Path path)  
      void close()
      Closes MapRFileSystem object
      void createTable​(org.apache.hadoop.hbase.HTableDescriptor desc, byte[][] splitKeys)
      Creates a new table.
      void deleteColumn​(java.lang.String tableName, java.lang.String columnName)  
      void deleteColumnPermission​(java.lang.String tablePath, java.lang.String column, java.lang.String permission)
      Deletes a permission from a column family or qualifier.
      void deleteTable​(java.lang.String tablePath)  
      void deleteTable​(org.apache.hadoop.fs.Path tablePath)  
      void deleteTablePermission​(java.lang.String tablePath, java.lang.String permission)
      Removes a permission from the MapR table
      org.apache.hadoop.hbase.HTableDescriptor[] deleteTables​(java.lang.String lookupPath)  
      void disableTable​(java.lang.String tableName)  
      org.apache.hadoop.hbase.HTableDescriptor[] disableTables​(java.lang.String regex)  
      protected org.apache.hadoop.fs.FileStatus[] doListTables​(java.lang.String lookupPath)
      Returns the list of Goose tables
      void enableTable​(java.lang.String tableName)  
      org.apache.hadoop.hbase.HTableDescriptor[] enableTables​(java.lang.String regex)  
      java.util.List<com.mapr.fs.tables.CFPermissions> getFamilyPermissions​(java.lang.String tablePath)
      Returns the list of column family permission including those set on the qualifiers.
      long getNumRows​(java.lang.String path)  
      org.apache.hadoop.hbase.HTableDescriptor getTableDescriptor​(java.lang.String tableName)
      Method for getting the tableDescriptor
      protected org.apache.hadoop.hbase.HTableDescriptor getTableDescriptor​(org.apache.hadoop.fs.Path tablePath)  
      protected org.apache.hadoop.fs.Path getTablePath​(byte[] tableName)  
      protected org.apache.hadoop.fs.Path getTablePath​(java.lang.String tableName)  
      java.util.Map<java.lang.String,​java.lang.String> getTablePermissions​(java.lang.String tablePath)
      Returns all ACEs set on the table as a Map.
      java.util.List<org.apache.hadoop.hbase.HRegionInfo> getTableRegions​(byte[] tableName)  
      boolean isTableAvailable​(java.lang.String tableName)  
      boolean isTableAvailable​(java.lang.String tableName, byte[][] splitKeys)  
      boolean isTableDisabled​(java.lang.String tableName)  
      boolean isTableEnabled​(java.lang.String tableName)  
      org.apache.hadoop.hbase.TableName[] listTableNames()
      List all the tables in users current directory.
      org.apache.hadoop.hbase.TableName[] listTableNames​(java.lang.String lookupPattern)
      List all the tables matching the pattern.
      org.apache.hadoop.hbase.HTableDescriptor[] listTables()
      List all the tables in users current directory.
      org.apache.hadoop.hbase.HTableDescriptor[] listTables​(java.lang.String lookupPattern)
      List all the tables matching the pattern.
      protected com.mapr.fs.MapRFileSystem maprfs()
      Delayed instantiation of MapRFileSystem so that a pure HBase application would not need to initialize FileSystem class
      void modifyColumn​(java.lang.String tableName, org.apache.hadoop.hbase.HColumnDescriptor cf)  
      void modifyColumn​(org.apache.hadoop.fs.Path tablePath, org.apache.hadoop.hbase.HColumnDescriptor cf)  
      void modifyTable​(java.lang.String tableName, org.apache.hadoop.hbase.HTableDescriptor htd)  
      void setFamilyPermissions​(java.lang.String tablePath, java.lang.String family, com.mapr.fs.tables.CFPermissions cfPermissions)
      Sets permissions on a column family.
      protected org.apache.hadoop.hbase.HTableDescriptor[] setTableDisabledStatus​(java.lang.String regex, java.lang.Boolean disabled)  
      void setTablePermissions​(java.lang.String tablePath, java.util.Map<java.lang.String,​java.lang.String> permissions)
      Sets the permissions ACEs on the MapR table.
      void setUser​(org.apache.hadoop.hbase.security.User user)
      Sets the User for the Admin instance.
      void split​(byte[] tableNameOrRegionName, byte[] splitPoint)
      Split a tablet or all the tablets of a table.
      boolean tableExists​(java.lang.String tablePath)
      Returns true if the path exists and is a table
      void truncateTable​(org.apache.hadoop.hbase.TableName tableName, boolean preserveSplits)  
      protected void unSupportedOperation​(java.lang.String operation)  
      • Methods inherited from class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin

        abortProcedure, abortProcedureAsync, assign, cloneSnapshot, closeRegion, closeRegion, closeRegionWithEncodedRegionName, compact, compact, coprocessorService, coprocessorService, createNamespace, deleteNamespace, deleteSnapshot, deleteSnapshots, enableCatalogJanitor, execProcedure, execProcedureWithRet, flush, getAlterStatus, getClusterStatus, getCompactionState, getCompactionStateForRegion, getLastMajorCompactionTimestamp, getLastMajorCompactionTimestampForRegion, getMasterCoprocessors, getMasterInfoPort, getNamespaceDescriptor, getOnlineRegions, getQuotaRetriever, getTableNames, getTableNames, getTableNames, isCatalogJanitorEnabled, isMasterRunning, isProcedureFinished, isSnapshotFinished, listNamespaceDescriptors, listProcedures, listSnapshots, listSnapshots, listTableDescriptorsByNamespace, listTableNamesByNamespace, mergeRegions, modifyNamespace, move, offline, rollHLogWriter, rollWALWriter, runCatalogScan, setQuota, shutdown, snapshot, snapshot, stopMaster, stopRegionServer, takeSnapshotAsync, unassign, updateConfiguration, updateConfiguration
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MaxTableCreateRetryCount

        public static int MaxTableCreateRetryCount
      • FIRST_JSON_COL_FAMILY

        public static java.lang.String FIRST_JSON_COL_FAMILY
    • Constructor Detail

      • HBaseAdminImpl

        public HBaseAdminImpl​(org.apache.hadoop.conf.Configuration c,
                              org.apache.hadoop.hbase.client.mapr.BaseTableMappingRules tableMappingRule)
        Parameters:
        c -
        tableMappingRule -
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Closes MapRFileSystem object
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • setUser

        public void setUser​(org.apache.hadoop.hbase.security.User user)
        Sets the User for the Admin instance.
        Overrides:
        setUser in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
      • tableExists

        public boolean tableExists​(java.lang.String tablePath)
                            throws java.io.IOException
        Returns true if the path exists and is a table
        Specified by:
        tableExists in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • listTables

        public org.apache.hadoop.hbase.HTableDescriptor[] listTables()
                                                              throws java.io.IOException
        List all the tables in users current directory.
        Specified by:
        listTables in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Returns:
        - returns an array of HTableDescriptors
        Throws:
        java.io.IOException - if a remote or network exception occurs
      • listTables

        public org.apache.hadoop.hbase.HTableDescriptor[] listTables​(java.lang.String lookupPattern)
                                                              throws java.io.IOException
        List all the tables matching the pattern. The parameter pattern can contain path and the last segment of path can optionally be a regular expression e.g. '/user/root/payroll.*'
        Specified by:
        listTables in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Returns:
        - returns an array of HTableDescriptors
        Throws:
        java.io.IOException - if a remote or network exception occurs
      • listTableNames

        public org.apache.hadoop.hbase.TableName[] listTableNames()
                                                           throws java.io.IOException
        List all the tables in users current directory.
        Specified by:
        listTableNames in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Returns:
        - returns an array of TableName
        Throws:
        java.io.IOException - if a remote or network exception occurs
      • listTableNames

        public org.apache.hadoop.hbase.TableName[] listTableNames​(java.lang.String lookupPattern)
                                                           throws java.io.IOException
        List all the tables matching the pattern. The parameter pattern can contain path and the last segment of path can optionally be a regular expression e.g. '/user/root/payroll.*'
        Specified by:
        listTableNames in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Returns:
        - returns an array of TableName
        Throws:
        java.io.IOException - if a remote or network exception occurs
      • doListTables

        protected org.apache.hadoop.fs.FileStatus[] doListTables​(java.lang.String lookupPath)
                                                          throws java.io.IOException
        Returns the list of Goose tables
        Parameters:
        lookupPath - The path with optional regular expression as the last segment of the path. If the pathString is a folder, returns all tables under that path.
        Returns:
        The array of HTableDescriptor constructed from the tables matching pathString.
        Throws:
        java.io.IOException
      • getTableDescriptor

        public org.apache.hadoop.hbase.HTableDescriptor getTableDescriptor​(java.lang.String tableName)
                                                                    throws org.apache.hadoop.hbase.TableNotFoundException,
                                                                           java.io.IOException
        Method for getting the tableDescriptor
        Specified by:
        getTableDescriptor in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Parameters:
        tableName - as a String
        Returns:
        the tableDescriptor
        Throws:
        org.apache.hadoop.hbase.TableNotFoundException
        java.io.IOException - if a remote or network exception occurs
      • getTableDescriptor

        protected org.apache.hadoop.hbase.HTableDescriptor getTableDescriptor​(org.apache.hadoop.fs.Path tablePath)
                                                                       throws org.apache.hadoop.hbase.TableNotFoundException,
                                                                              java.io.IOException
        Throws:
        org.apache.hadoop.hbase.TableNotFoundException
        java.io.IOException
      • createTable

        public void createTable​(org.apache.hadoop.hbase.HTableDescriptor desc,
                                byte[][] splitKeys)
                         throws java.io.IOException
        Creates a new table. Synchronous operation.
        Specified by:
        createTable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Parameters:
        desc - table descriptor for table
        Throws:
        org.apache.hadoop.hbase.TableExistsException - if table already exists (If concurrent threads, the table may have been created between test-for-existence and attempt-at-creation).
        java.io.IOException - if a remote or network exception occurs
      • deleteTable

        public void deleteTable​(java.lang.String tablePath)
                         throws java.io.IOException
        Specified by:
        deleteTable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • deleteTable

        public void deleteTable​(org.apache.hadoop.fs.Path tablePath)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • deleteTables

        public org.apache.hadoop.hbase.HTableDescriptor[] deleteTables​(java.lang.String lookupPath)
                                                                throws java.io.IOException
        Specified by:
        deleteTables in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • addColumn

        public void addColumn​(java.lang.String tableName,
                              org.apache.hadoop.hbase.HColumnDescriptor cf)
                       throws java.io.IOException
        Specified by:
        addColumn in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • addColumn

        public void addColumn​(org.apache.hadoop.fs.Path tablePath,
                              org.apache.hadoop.hbase.HColumnDescriptor cf)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • modifyColumn

        public void modifyColumn​(java.lang.String tableName,
                                 org.apache.hadoop.hbase.HColumnDescriptor cf)
                          throws java.io.IOException
        Specified by:
        modifyColumn in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • modifyColumn

        public void modifyColumn​(org.apache.hadoop.fs.Path tablePath,
                                 org.apache.hadoop.hbase.HColumnDescriptor cf)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • deleteColumn

        public void deleteColumn​(java.lang.String tableName,
                                 java.lang.String columnName)
                          throws java.io.IOException
        Specified by:
        deleteColumn in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • modifyTable

        public void modifyTable​(java.lang.String tableName,
                                org.apache.hadoop.hbase.HTableDescriptor htd)
                         throws java.io.IOException
        Specified by:
        modifyTable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • enableTable

        public void enableTable​(java.lang.String tableName)
                         throws java.io.IOException
        Specified by:
        enableTable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • enableTables

        public org.apache.hadoop.hbase.HTableDescriptor[] enableTables​(java.lang.String regex)
                                                                throws java.io.IOException
        Specified by:
        enableTables in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • disableTable

        public void disableTable​(java.lang.String tableName)
                          throws java.io.IOException
        Specified by:
        disableTable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • disableTables

        public org.apache.hadoop.hbase.HTableDescriptor[] disableTables​(java.lang.String regex)
                                                                 throws java.io.IOException
        Specified by:
        disableTables in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • isTableEnabled

        public boolean isTableEnabled​(java.lang.String tableName)
                               throws java.io.IOException
        Specified by:
        isTableEnabled in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • isTableDisabled

        public boolean isTableDisabled​(java.lang.String tableName)
                                throws java.io.IOException
        Specified by:
        isTableDisabled in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • isTableAvailable

        public boolean isTableAvailable​(java.lang.String tableName)
                                 throws java.io.IOException
        Specified by:
        isTableAvailable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • isTableAvailable

        public boolean isTableAvailable​(java.lang.String tableName,
                                        byte[][] splitKeys)
                                 throws java.io.IOException
        Specified by:
        isTableAvailable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • getTableRegions

        public java.util.List<org.apache.hadoop.hbase.HRegionInfo> getTableRegions​(byte[] tableName)
                                                                            throws java.io.IOException
        Specified by:
        getTableRegions in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException
      • split

        public void split​(byte[] tableNameOrRegionName,
                          byte[] splitPoint)
                   throws java.io.IOException
        Split a tablet or all the tablets of a table.
        Overrides:
        split in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Parameters:
        tableNameOrRegionName - String specifying either a table path with optional tablet FID separated by ",". If a tablet FID is not specified, all tablets of the table are split.
        Throws:
        java.io.IOException
      • setTablePermissions

        public void setTablePermissions​(java.lang.String tablePath,
                                        java.util.Map<java.lang.String,​java.lang.String> permissions)
                                 throws java.io.IOException
        Sets the permissions ACEs on the MapR table.
        Parameters:
        tablePath -
        permissions -
        Throws:
        java.io.IOException
      • getTablePermissions

        public java.util.Map<java.lang.String,​java.lang.String> getTablePermissions​(java.lang.String tablePath)
                                                                                   throws java.io.IOException
        Returns all ACEs set on the table as a Map. Key of this map is the permission name while the value is the ACE for that permission.
        Parameters:
        tablePath -
        Returns:
        Throws:
        java.io.IOException
      • deleteTablePermission

        public void deleteTablePermission​(java.lang.String tablePath,
                                          java.lang.String permission)
                                   throws java.io.IOException
        Removes a permission from the MapR table
        Parameters:
        tablePath -
        permission -
        Throws:
        java.io.IOException
      • setFamilyPermissions

        public void setFamilyPermissions​(java.lang.String tablePath,
                                         java.lang.String family,
                                         com.mapr.fs.tables.CFPermissions cfPermissions)
                                  throws java.io.IOException
        Sets permissions on a column family. See CFPermissions for details.
        Parameters:
        tablePath -
        family -
        cfPermissions -
        Throws:
        java.io.IOException
      • getFamilyPermissions

        public java.util.List<com.mapr.fs.tables.CFPermissions> getFamilyPermissions​(java.lang.String tablePath)
                                                                              throws java.io.IOException
        Returns the list of column family permission including those set on the qualifiers. See also CFPermissions.
        Parameters:
        tablePath -
        Returns:
        Throws:
        java.io.IOException
      • deleteColumnPermission

        public void deleteColumnPermission​(java.lang.String tablePath,
                                           java.lang.String column,
                                           java.lang.String permission)
                                    throws java.io.IOException
        Deletes a permission from a column family or qualifier.
        Parameters:
        tablePath -
        column -
        permission -
        Throws:
        java.io.IOException
      • maprfs

        protected com.mapr.fs.MapRFileSystem maprfs()
                                             throws java.io.IOException
        Delayed instantiation of MapRFileSystem so that a pure HBase application would not need to initialize FileSystem class
        Returns:
        Throws:
        java.io.IOException
      • admin

        protected com.mapr.fs.tables.MapRAdmin admin()
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • setTableDisabledStatus

        protected org.apache.hadoop.hbase.HTableDescriptor[] setTableDisabledStatus​(java.lang.String regex,
                                                                                    java.lang.Boolean disabled)
                                                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getTablePath

        protected org.apache.hadoop.fs.Path getTablePath​(java.lang.String tableName)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • getTablePath

        protected org.apache.hadoop.fs.Path getTablePath​(byte[] tableName)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • unSupportedOperation

        protected void unSupportedOperation​(java.lang.String operation)
      • checkTable

        protected void checkTable​(org.apache.hadoop.fs.Path path)
                           throws java.io.IOException,
                                  org.apache.hadoop.hbase.TableNotFoundException
        Throws:
        java.io.IOException
        org.apache.hadoop.hbase.TableNotFoundException
      • getNumRows

        public long getNumRows​(java.lang.String path)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • truncateTable

        public void truncateTable​(org.apache.hadoop.hbase.TableName tableName,
                                  boolean preserveSplits)
                           throws java.io.IOException
        Overrides:
        truncateTable in class org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
        Throws:
        java.io.IOException