public abstract class HBaseTableUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HBaseTableUtil.BloomType
Represents the bloom filter types supported for HBase tables.
|
static class |
HBaseTableUtil.CompressionType
Represents the compression types supported for HBase tables.
|
static class |
HBaseTableUtil.CoprocessorInfo
Carries information about coprocessor information.
|
static class |
HBaseTableUtil.TableStats
Carries information about table stats
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CFG_HBASE_TABLE_COMPRESSION |
static int |
DEFAULT_WRITE_BUFFER_SIZE |
static long |
MAX_CREATE_TABLE_WAIT |
protected String |
tablePrefix |
| Constructor and Description |
|---|
HBaseTableUtil() |
public static final long MAX_CREATE_TABLE_WAIT
public static final int DEFAULT_WRITE_BUFFER_SIZE
public static final String CFG_HBASE_TABLE_COMPRESSION
protected String tablePrefix
public void setCConf(CConfiguration cConf)
protected boolean isCDAPTable(org.apache.hadoop.hbase.HTableDescriptor hTableDescriptor)
public void createTableIfNotExists(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId, org.apache.hadoop.hbase.HTableDescriptor tableDescriptor) throws IOException
admin - the hbase admintableId - the TableId for the table to createtableDescriptor - hbase table descriptor for the new tableIOExceptionpublic void createTableIfNotExists(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId, org.apache.hadoop.hbase.HTableDescriptor tableDescriptor, @Nullable byte[][] splitKeys) throws IOException
createTableIfNotExists(HBaseAdmin, TableId, HTableDescriptor, byte[][], long, TimeUnit)
with timeout = MAX_CREATE_TABLE_WAIT milliseconds.IOExceptionpublic void createTableIfNotExists(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId, org.apache.hadoop.hbase.HTableDescriptor tableDescriptor, @Nullable byte[][] splitKeys, long timeout, TimeUnit timeoutUnit) throws IOException
admin - the hbase admintableId - TableId representing the tabletableDescriptor - hbase table descriptor for the new tabletimeout - Maximum time to wait for table creation.timeoutUnit - The TimeUnit for timeout.IOExceptionpublic static byte[][] getSplitKeys(int splits,
int buckets,
AbstractRowKeyDistributor keyDistributor)
public static Location createCoProcessorJar(String filePrefix, Location jarDir, Iterable<? extends Class<? extends org.apache.hadoop.hbase.Coprocessor>> classes) throws IOException
IOExceptionpublic static Map<String,HBaseTableUtil.CoprocessorInfo> getCoprocessorInfo(org.apache.hadoop.hbase.HTableDescriptor tableDescriptor)
public abstract org.apache.hadoop.hbase.client.HTable createHTable(Configuration conf, TableId tableId) throws IOException
HTable which may contain an HBase namespace depending on the HBase versionconf - the hadoop configurationtableId - the TableId to create an HTable forHTable for the tableName in the namespaceIOExceptionpublic abstract HTableDescriptorBuilder buildHTableDescriptor(TableId tableId)
HTableDescriptorBuilder which may contain an HBase namespace depending on the HBase versiontableId - the TableId to create an HTableDescriptor forHTableDescriptorBuilder for the tablepublic abstract HTableDescriptorBuilder buildHTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor tableDescriptor)
HTableDescriptorBuilder which may contain an HBase namespace depending on the HBase versiontableDescriptor - the HTableDescriptor whose values should be copiedHTableDescriptorBuilder for the tablepublic abstract org.apache.hadoop.hbase.HTableDescriptor getHTableDescriptor(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
HTableDescriptor which may contain an HBase namespace for an existing tableadmin - the HBaseAdmin to use to communicate with HBasetableId - the TableId to construct an HTableDescriptor forHTableDescriptor for the tableIOExceptionpublic abstract boolean hasNamespace(org.apache.hadoop.hbase.client.HBaseAdmin admin, Id.Namespace namespace) throws IOException
admin - the HBaseAdmin to use to communicate with HBasenamespace - the Id.Namespace to check for existenceIOException - if an I/O error occurs during the operationpublic abstract void createNamespaceIfNotExists(org.apache.hadoop.hbase.client.HBaseAdmin admin, Id.Namespace namespace) throws IOException
Id.Namespace here to cover for a future case when CDAP namespaces may push down namespace
properties to HBaseadmin - the HBaseAdmin to use to communicate with HBasenamespace - the Id.Namespace to createIOException - if an I/O error occurs during the operationpublic abstract void deleteNamespaceIfExists(org.apache.hadoop.hbase.client.HBaseAdmin admin, Id.Namespace namespace) throws IOException
admin - the HBaseAdmin to use to communicate with HBasenamespace - the Id.Namespace to deleteIOException - if an I/O error occurs during the operationpublic abstract void disableTable(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasetableId - TableId for the specified tableIOExceptionpublic abstract void enableTable(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasetableId - TableId for the specified tableIOExceptionpublic abstract boolean tableExists(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasetableId - TableId for the specified tableIOExceptionpublic abstract void deleteTable(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasetableId - TableId for the specified tableIOExceptionpublic abstract void modifyTable(org.apache.hadoop.hbase.client.HBaseAdmin admin, org.apache.hadoop.hbase.HTableDescriptor tableDescriptor) throws IOException
admin - the HBaseAdmin to use to communicate with HBasetableDescriptor - the modified HTableDescriptorIOExceptionpublic abstract List<org.apache.hadoop.hbase.HRegionInfo> getTableRegions(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
HRegionInfo for the specified TableIdadmin - the HBaseAdmin to use to communicate with HBasetableId - TableId for the specified tableHRegionInfo for the specified TableIdIOExceptionpublic void deleteAllInNamespace(org.apache.hadoop.hbase.client.HBaseAdmin admin, Id.Namespace namespaceId, com.google.common.base.Predicate<TableId> predicate) throws IOException
Predicate.admin - the HBaseAdmin to use to communicate with HBasenamespaceId - namespace for which the tables are being deletedpredicate - The Predicate to decide whether to drop a table or notIOExceptionpublic void deleteAllInNamespace(org.apache.hadoop.hbase.client.HBaseAdmin admin, Id.Namespace namespaceId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasenamespaceId - namespace for which the tables are being deletedIOExceptionpublic abstract List<TableId> listTablesInNamespace(org.apache.hadoop.hbase.client.HBaseAdmin admin, Id.Namespace namespaceId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasenamespaceId - namespace for which the tables are being requestedIOExceptionpublic abstract List<TableId> listTables(org.apache.hadoop.hbase.client.HBaseAdmin admin) throws IOException
admin - the HBaseAdmin to use to communicate with HBaseIOExceptionpublic void dropTable(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasetableId - TableId for the specified tableIOExceptionpublic void truncateTable(org.apache.hadoop.hbase.client.HBaseAdmin admin, TableId tableId) throws IOException
admin - the HBaseAdmin to use to communicate with HBasetableId - TableId for the specified tableIOExceptionpublic ScanBuilder buildScan()
ScanBuilder.public ScanBuilder buildScan(org.apache.hadoop.hbase.client.Scan scan) throws IOException
ScanBuilder by copying from another Scan instance.IOExceptionpublic PutBuilder buildPut(byte[] row)
PutBuilder for the given row.public PutBuilder buildPut(org.apache.hadoop.hbase.client.Put put)
PutBuilder by copying from another Put instance.public GetBuilder buildGet(byte[] row)
GetBuilder for the given row.public GetBuilder buildGet(org.apache.hadoop.hbase.client.Get get)
GetBuilder by copying from another Get instance.public DeleteBuilder buildDelete(byte[] row)
DeleteBuilder for the given row.public DeleteBuilder buildDelete(org.apache.hadoop.hbase.client.Delete delete)
DeleteBuilder by copying from another Delete instance.public abstract void setCompression(org.apache.hadoop.hbase.HColumnDescriptor columnDescriptor, HBaseTableUtil.CompressionType type)
public abstract void setBloomFilter(org.apache.hadoop.hbase.HColumnDescriptor columnDescriptor, HBaseTableUtil.BloomType type)
public abstract HBaseTableUtil.CompressionType getCompression(org.apache.hadoop.hbase.HColumnDescriptor columnDescriptor)
public abstract HBaseTableUtil.BloomType getBloomFilter(org.apache.hadoop.hbase.HColumnDescriptor columnDescriptor)
public abstract Class<? extends org.apache.hadoop.hbase.Coprocessor> getTransactionDataJanitorClassForVersion()
public abstract Class<? extends org.apache.hadoop.hbase.Coprocessor> getQueueRegionObserverClassForVersion()
public abstract Class<? extends org.apache.hadoop.hbase.Coprocessor> getDequeueScanObserverClassForVersion()
public abstract Class<? extends org.apache.hadoop.hbase.Coprocessor> getIncrementHandlerClassForVersion()
public abstract Map<TableId,HBaseTableUtil.TableStats> getTableStats(org.apache.hadoop.hbase.client.HBaseAdmin admin) throws IOException
Map<TableId, TableStats>admin - instance of HBaseAdmin to communicate with HBaseIOExceptionCopyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.