Package com.mapr.fs.hbase
Class HBaseAdminImpl
- java.lang.Object
-
- org.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
-
- com.mapr.fs.hbase.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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFIRST_JSON_COL_FAMILYstatic intMaxTableCreateRetryCount-
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, GlobalClusterConfDefault, 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, IPV6_ADDR_ENDER, IPV6_ADDR_STARTER, IPv6DefaultCLDBIp, 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, SSL_TRUSTSTORE, UserBit, UTF8_ENCODING, WireSecureBit
-
Fields inherited from interface com.mapr.fs.hbase.MapRDBConstants
COMMITTED_COL, DB_META_TABLE, DB_META_TABLE_BYTES, DEFAULT_BLOCKSIZE, DEFAULT_CF, FALSE, FALSE_VALUE, FID_COL, MAPR_UUID, TRUE, TRUE_VALUE
-
-
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 voidaddColumn(java.lang.String tableName, org.apache.hadoop.hbase.HColumnDescriptor cf)voidaddColumn(org.apache.hadoop.fs.Path tablePath, org.apache.hadoop.hbase.HColumnDescriptor cf)protected com.mapr.fs.tables.MapRAdminadmin()protected voidcheckTable(org.apache.hadoop.fs.Path path)voidclose()ClosesMapRFileSystemobjectvoidcreateTable(org.apache.hadoop.hbase.HTableDescriptor desc, byte[][] splitKeys)Creates a new table.voiddeleteColumn(java.lang.String tableName, java.lang.String columnName)voiddeleteColumnPermission(java.lang.String tablePath, java.lang.String column, java.lang.String permission)Deletes a permission from a column family or qualifier.voiddeleteTable(java.lang.String tablePath)voiddeleteTable(org.apache.hadoop.fs.Path tablePath)voiddeleteTablePermission(java.lang.String tablePath, java.lang.String permission)Removes a permission from the MapR tableorg.apache.hadoop.hbase.HTableDescriptor[]deleteTables(java.lang.String lookupPath)voiddisableTable(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 tablesvoidenableTable(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.longgetNumRows(java.lang.String path)org.apache.hadoop.hbase.HTableDescriptorgetTableDescriptor(java.lang.String tableName)Method for getting the tableDescriptorprotected org.apache.hadoop.hbase.HTableDescriptorgetTableDescriptor(org.apache.hadoop.fs.Path tablePath)protected org.apache.hadoop.fs.PathgetTablePath(byte[] tableName)protected org.apache.hadoop.fs.PathgetTablePath(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 aMap.java.util.List<org.apache.hadoop.hbase.HRegionInfo>getTableRegions(byte[] tableName)booleanisTableAvailable(java.lang.String tableName)booleanisTableAvailable(java.lang.String tableName, byte[][] splitKeys)booleanisTableDisabled(java.lang.String tableName)booleanisTableEnabled(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.MapRFileSystemmaprfs()Delayed instantiation of MapRFileSystem so that a pure HBase application would not need to initialize FileSystem classvoidmodifyColumn(java.lang.String tableName, org.apache.hadoop.hbase.HColumnDescriptor cf)voidmodifyColumn(org.apache.hadoop.fs.Path tablePath, org.apache.hadoop.hbase.HColumnDescriptor cf)voidmodifyTable(java.lang.String tableName, org.apache.hadoop.hbase.HTableDescriptor htd)voidsetFamilyPermissions(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)voidsetTablePermissions(java.lang.String tablePath, java.util.Map<java.lang.String,java.lang.String> permissions)Sets the permissions ACEs on the MapR table.voidsetUser(org.apache.hadoop.hbase.security.User user)Sets the User for the Admin instance.voidsplit(byte[] tableNameOrRegionName, byte[] splitPoint)Split a tablet or all the tablets of a table.booleantableExists(java.lang.String tablePath)Returns true if the path exists and is a tablevoidtruncateTable(org.apache.hadoop.hbase.TableName tableName, boolean preserveSplits)protected voidunSupportedOperation(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
-
-
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionClosesMapRFileSystemobject- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classorg.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:
setUserin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin
-
tableExists
public boolean tableExists(java.lang.String tablePath) throws java.io.IOExceptionReturns true if the path exists and is a table- Specified by:
tableExistsin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
listTables
public org.apache.hadoop.hbase.HTableDescriptor[] listTables() throws java.io.IOExceptionList all the tables in users current directory.- Specified by:
listTablesin classorg.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.IOExceptionList 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:
listTablesin classorg.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.IOExceptionList all the tables in users current directory.- Specified by:
listTableNamesin classorg.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.IOExceptionList 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:
listTableNamesin classorg.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.IOExceptionReturns the list of Goose tables- Parameters:
lookupPath- The path with optional regular expression as the last segment of the path. If thepathStringis a folder, returns all tables under that path.- Returns:
- The array of
HTableDescriptorconstructed from the tables matchingpathString. - Throws:
java.io.IOException
-
getTableDescriptor
public org.apache.hadoop.hbase.HTableDescriptor getTableDescriptor(java.lang.String tableName) throws org.apache.hadoop.hbase.TableNotFoundException, java.io.IOExceptionMethod for getting the tableDescriptor- Specified by:
getTableDescriptorin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Parameters:
tableName- as a String- Returns:
- the tableDescriptor
- Throws:
org.apache.hadoop.hbase.TableNotFoundExceptionjava.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.TableNotFoundExceptionjava.io.IOException
-
createTable
public void createTable(org.apache.hadoop.hbase.HTableDescriptor desc, byte[][] splitKeys) throws java.io.IOExceptionCreates a new table. Synchronous operation.- Specified by:
createTablein classorg.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:
deleteTablein classorg.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:
deleteTablesin classorg.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:
addColumnin classorg.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:
modifyColumnin classorg.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:
deleteColumnin classorg.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:
modifyTablein classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
enableTable
public void enableTable(java.lang.String tableName) throws java.io.IOException- Specified by:
enableTablein classorg.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:
enableTablesin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
disableTable
public void disableTable(java.lang.String tableName) throws java.io.IOException- Specified by:
disableTablein classorg.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:
disableTablesin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
isTableEnabled
public boolean isTableEnabled(java.lang.String tableName) throws java.io.IOException- Specified by:
isTableEnabledin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
isTableDisabled
public boolean isTableDisabled(java.lang.String tableName) throws java.io.IOException- Specified by:
isTableDisabledin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
isTableAvailable
public boolean isTableAvailable(java.lang.String tableName) throws java.io.IOException- Specified by:
isTableAvailablein classorg.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:
isTableAvailablein classorg.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:
getTableRegionsin classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
split
public void split(byte[] tableNameOrRegionName, byte[] splitPoint) throws java.io.IOExceptionSplit a tablet or all the tablets of a table.- Overrides:
splitin classorg.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.IOExceptionSets 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.IOExceptionReturns all ACEs set on the table as aMap. 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.IOExceptionRemoves 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.IOExceptionSets permissions on a column family. SeeCFPermissionsfor 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.IOExceptionReturns the list of column family permission including those set on the qualifiers. See alsoCFPermissions.- 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.IOExceptionDeletes 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.IOExceptionDelayed 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.IOExceptionorg.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:
truncateTablein classorg.apache.hadoop.hbase.client.mapr.AbstractHBaseAdmin- Throws:
java.io.IOException
-
-