@InterfaceAudience.Public @InterfaceStability.Evolving public class HTableDescriptor extends Object implements org.apache.hadoop.io.WritableComparable<HTableDescriptor>
-ROOT- or
hbase:meta , if the table is read only, the maximum size of the memstore,
when the region split should occur, coprocessors associated with it etc...| Modifier and Type | Field and Description |
|---|---|
static String |
COMPACTION_ENABLED
INTERNAL Used by HBase Shell interface to access this metadata
attribute which denotes if the table is compaction enabled
|
static boolean |
DEFAULT_COMPACTION_ENABLED
Constant that denotes whether the table is compaction enabled by default
|
static long |
DEFAULT_MEMSTORE_FLUSH_SIZE
Constant that denotes the maximum default size of the memstore after which
the contents are flushed to the store files
|
static boolean |
DEFAULT_READONLY
Constant that denotes whether the table is READONLY by default and is false
|
static String |
DEFERRED_LOG_FLUSH
Deprecated.
Use
DURABILITY instead. |
static String |
DURABILITY
INTERNAL
Durability setting for the table. |
static String |
IS_META
INTERNAL Used by rest interface to access this metadata
attribute which denotes if it is a catalog table, either
hbase:meta or -ROOT- |
static String |
IS_ROOT
INTERNAL Used by rest interface to access this metadata
attribute which denotes if the table is a -ROOT- region or not
|
static String |
MAX_FILESIZE
INTERNAL Used by HBase Shell interface to access this metadata
attribute which denotes the maximum size of the store file after which
a region split occurs
|
static String |
MEMSTORE_FLUSHSIZE
INTERNAL Used by HBase Shell interface to access this metadata
attribute which represents the maximum size of the memstore after which
its contents are flushed onto the disk
|
static HTableDescriptor |
META_TABLEDESC
Table descriptor for
hbase:meta catalog table |
static byte[] |
NAMESPACE_COL_DESC_BYTES |
static String |
NAMESPACE_FAMILY_INFO |
static byte[] |
NAMESPACE_FAMILY_INFO_BYTES |
static HTableDescriptor |
NAMESPACE_TABLEDESC
Table descriptor for namespace table
|
static String |
OWNER |
static ImmutableBytesWritable |
OWNER_KEY |
static String |
READONLY
INTERNAL Used by rest interface to access this metadata
attribute which denotes if the table is Read Only
|
static String |
SPLIT_POLICY |
| Modifier | Constructor and Description |
|---|---|
|
HTableDescriptor()
Deprecated.
Used by Writables and Writables are going away.
|
|
HTableDescriptor(byte[] name)
Deprecated.
|
|
HTableDescriptor(HTableDescriptor desc)
Construct a table descriptor by cloning the descriptor passed as a parameter.
|
|
HTableDescriptor(String name)
Deprecated.
|
|
HTableDescriptor(TableName name)
Construct a table descriptor specifying a TableName object
|
protected |
HTableDescriptor(TableName name,
HColumnDescriptor[] families)
INTERNAL Private constructor used internally creating table descriptors for
catalog tables,
hbase:meta and -ROOT-. |
protected |
HTableDescriptor(TableName name,
HColumnDescriptor[] families,
Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
INTERNAL Private constructor used internally creating table descriptors for
catalog tables,
hbase:meta and -ROOT-. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCoprocessor(String className)
Add a table coprocessor to this table.
|
void |
addCoprocessor(String className,
org.apache.hadoop.fs.Path jarFilePath,
int priority,
Map<String,String> kvs)
Add a table coprocessor to this table.
|
void |
addFamily(HColumnDescriptor family)
Adds a column family.
|
int |
compareTo(HTableDescriptor other)
Compares the descriptor with another descriptor which is passed as a parameter.
|
HBaseProtos.TableSchema |
convert() |
static HTableDescriptor |
convert(HBaseProtos.TableSchema ts) |
boolean |
equals(Object obj)
Compare the contents of the descriptor with another one passed as a parameter.
|
HColumnDescriptor[] |
getColumnFamilies()
Returns an array all the
HColumnDescriptor of the column families
of the table. |
Map<String,String> |
getConfiguration()
Getter for fetching an unmodifiable
configuration map. |
String |
getConfigurationValue(String key)
Getter for accessing the configuration value by key
|
List<String> |
getCoprocessors()
Return the list of attached co-processor represented by their name className
|
Durability |
getDurability()
Returns the durability setting for the table.
|
Collection<HColumnDescriptor> |
getFamilies()
Returns an unmodifiable collection of all the
HColumnDescriptor
of all the column families of the table. |
Set<byte[]> |
getFamiliesKeys()
Returns all the column family names of the current table.
|
HColumnDescriptor |
getFamily(byte[] column)
Returns the HColumnDescriptor for a specific column family with name as
specified by the parameter column.
|
long |
getMaxFileSize()
Returns the maximum size upto which a region can grow to after which a region
split is triggered.
|
long |
getMemStoreFlushSize()
Returns the size of the memstore after which a flush to filesystem is triggered.
|
byte[] |
getName()
Get the name of the table as a byte array.
|
String |
getNameAsString()
Get the name of the table as a String
|
String |
getOwnerString()
Deprecated.
|
String |
getRegionSplitPolicyClassName()
This get the class associated with the region split policy which
determines when a region split should occur.
|
static org.apache.hadoop.fs.Path |
getTableDir(org.apache.hadoop.fs.Path rootdir,
byte[] tableName)
Deprecated.
|
TableName |
getTableName()
Get the name of the table
|
byte[] |
getValue(byte[] key)
Getter for accessing the metadata associated with the key
|
String |
getValue(String key)
Getter for accessing the metadata associated with the key
|
Map<ImmutableBytesWritable,ImmutableBytesWritable> |
getValues()
Getter for fetching an unmodifiable
values map. |
boolean |
hasCoprocessor(String className)
Check if the table has an attached co-processor represented by the name className
|
boolean |
hasFamily(byte[] familyName)
Checks to see if this table contains the given column family
|
int |
hashCode() |
boolean |
isCompactionEnabled()
Check if the compaction enable flag of the table is true.
|
boolean |
isDeferredLogFlush()
Deprecated.
|
boolean |
isMetaRegion()
Checks if this table is
hbase:meta
region. |
boolean |
isMetaTable()
Checks if the table is a
hbase:meta table |
boolean |
isReadOnly()
Check if the readOnly flag of the table is set.
|
boolean |
isRootRegion()
Check if the descriptor represents a
-ROOT- region. |
static HTableDescriptor |
parseFrom(byte[] bytes) |
void |
readFields(DataInput in)
Deprecated.
Writables are going away. Use pb
parseFrom(byte[]) instead. |
void |
remove(byte[] key)
Remove metadata represented by the key from the
values map |
void |
remove(ImmutableBytesWritable key)
Remove metadata represented by the key from the
values map |
void |
remove(String key)
Remove metadata represented by the key from the
values map |
void |
removeConfiguration(String key)
Remove a config setting represented by the key from the
configuration map |
void |
removeCoprocessor(String className)
Remove a coprocessor from those set on the table
|
HColumnDescriptor |
removeFamily(byte[] column)
Removes the HColumnDescriptor with name specified by the parameter column
from the table descriptor
|
void |
setCompactionEnabled(boolean isEnable)
Setting the table compaction enable flag.
|
void |
setConfiguration(String key,
String value)
Setter for storing a configuration setting in
configuration map. |
void |
setDeferredLogFlush(boolean isAsyncLogFlush)
Deprecated.
|
void |
setDurability(Durability durability)
Sets the
Durability setting for the table. |
void |
setMaxFileSize(long maxFileSize)
Sets the maximum size upto which a region can grow to after which a region
split is triggered.
|
void |
setMemStoreFlushSize(long memstoreFlushSize)
Represents the maximum size of the memstore after which the contents of the
memstore are flushed to the filesystem.
|
protected void |
setMetaRegion(boolean isMeta)
INTERNAL Used to denote if the current table represents
-ROOT- or hbase:meta region. |
void |
setName(byte[] name)
Deprecated.
|
void |
setName(TableName name)
Deprecated.
|
void |
setOwner(User owner)
Deprecated.
|
void |
setOwnerString(String ownerString)
Deprecated.
|
void |
setReadOnly(boolean readOnly)
Setting the table as read only sets all the columns in the table as read
only.
|
protected void |
setRootRegion(boolean isRoot)
INTERNAL Used to denote if the current table represents
-ROOT- region. |
void |
setValue(byte[] key,
byte[] value)
Setter for storing metadata as a (key, value) pair in
values map |
void |
setValue(ImmutableBytesWritable key,
ImmutableBytesWritable value) |
void |
setValue(String key,
String value)
Setter for storing metadata as a (key, value) pair in
values map |
byte[] |
toByteArray() |
String |
toString() |
String |
toStringCustomizedValues() |
void |
write(DataOutput out)
Deprecated.
Writables are going away.
Use
MessageLite.toByteArray() instead. |
public static final String SPLIT_POLICY
public static final String MAX_FILESIZE
getMaxFileSize(),
Constant Field Valuespublic static final String OWNER
public static final ImmutableBytesWritable OWNER_KEY
public static final String READONLY
isReadOnly(),
Constant Field Valuespublic static final String COMPACTION_ENABLED
isCompactionEnabled(),
Constant Field Valuespublic static final String MEMSTORE_FLUSHSIZE
getMemStoreFlushSize(),
Constant Field Valuespublic static final String IS_ROOT
isRootRegion(),
Constant Field Valuespublic static final String IS_META
hbase:meta or -ROOT- isMetaRegion(),
Constant Field Values@Deprecated public static final String DEFERRED_LOG_FLUSH
DURABILITY instead.public static final String DURABILITY
Durability setting for the table.public static final boolean DEFAULT_READONLY
public static final boolean DEFAULT_COMPACTION_ENABLED
public static final long DEFAULT_MEMSTORE_FLUSH_SIZE
public static final HTableDescriptor META_TABLEDESC
hbase:meta catalog tablepublic static final String NAMESPACE_FAMILY_INFO
public static final byte[] NAMESPACE_FAMILY_INFO_BYTES
public static final byte[] NAMESPACE_COL_DESC_BYTES
public static final HTableDescriptor NAMESPACE_TABLEDESC
protected HTableDescriptor(TableName name, HColumnDescriptor[] families)
hbase:meta and -ROOT-.protected HTableDescriptor(TableName name, HColumnDescriptor[] families, Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
hbase:meta and -ROOT-.@Deprecated public HTableDescriptor()
public HTableDescriptor(TableName name)
name - Table name.@Deprecated public HTableDescriptor(byte[] name)
name - Table name.@Deprecated public HTableDescriptor(String name)
name - Table name.public HTableDescriptor(HTableDescriptor desc)
Makes a deep copy of the supplied descriptor. Can make a modifiable descriptor from an UnmodifyableHTableDescriptor.
desc - The descriptor.public boolean isRootRegion()
-ROOT- region. -ROOT- regionprotected void setRootRegion(boolean isRoot)
-ROOT- region. This is used internally by the
HTableDescriptor constructorsisRoot - true if this is the -ROOT- regionpublic boolean isMetaRegion()
hbase:meta
region. hbase:meta
regionprotected void setMetaRegion(boolean isMeta)
-ROOT- or hbase:meta region. This is used
internally by the HTableDescriptor constructorsisMeta - true if its either -ROOT- or
hbase:meta regionpublic boolean isMetaTable()
hbase:meta table hbase:meta region.public byte[] getValue(byte[] key)
key - The key.valuespublic String getValue(String key)
key - The key.valuespublic Map<ImmutableBytesWritable,ImmutableBytesWritable> getValues()
values map.public void setValue(byte[] key,
byte[] value)
values mapkey - The key.value - The value.valuespublic void setValue(ImmutableBytesWritable key, ImmutableBytesWritable value)
public void setValue(String key, String value)
values mapkey - The key.value - The value.valuespublic void remove(String key)
values mapkey - Key whose key and value we're to remove from HTableDescriptor
parameters.public void remove(ImmutableBytesWritable key)
values mapkey - Key whose key and value we're to remove from HTableDescriptor
parameters.public void remove(byte[] key)
values mapkey - Key whose key and value we're to remove from HTableDescriptor
parameters.public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
readOnly - True if all of the columns in the table should be read
only.public boolean isCompactionEnabled()
public void setCompactionEnabled(boolean isEnable)
isEnable - True if enable compaction.@Deprecated public boolean isDeferredLogFlush()
#setAsyncLogFlush(boolean)@Deprecated public void setDeferredLogFlush(boolean isAsyncLogFlush)
NOTE:- This option might result in data loss if the region server crashes before these pending edits in memory are flushed onto the filesystem.
isAsyncLogFlush - public void setDurability(Durability durability)
Durability setting for the table. This defaults to Durability.USE_DEFAULT.durability - enum valuepublic Durability getDurability()
public TableName getTableName()
public byte[] getName()
public String getNameAsString()
public String getRegionSplitPolicyClassName()
RegionSplitPolicy@Deprecated public void setName(byte[] name)
name - name of table@Deprecated public void setName(TableName name)
public long getMaxFileSize()
setMaxFileSize(long)public void setMaxFileSize(long maxFileSize)
This is not an absolute value and might vary. Assume that a single row exceeds the maxFileSize then the storeFileSize will be greater than maxFileSize since a single row cannot be split across multiple regions
maxFileSize - The maximum file size that a store file can grow to
before a split is triggered.public long getMemStoreFlushSize()
setMemStoreFlushSize(long)public void setMemStoreFlushSize(long memstoreFlushSize)
memstoreFlushSize - memory cache flush size for each hregionpublic void addFamily(HColumnDescriptor family)
family - HColumnDescriptor of family to add.public boolean hasFamily(byte[] familyName)
familyName - Family name or column name.public String toString()
toString in class ObjectgetNameAsString()public String toStringCustomizedValues()
public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class ObjectObject.hashCode()@Deprecated public void readFields(DataInput in) throws IOException
parseFrom(byte[]) instead.WritableComparable interface
and is used for de-serialization of the HTableDescriptor over RPCreadFields in interface org.apache.hadoop.io.WritableIOException@Deprecated public void write(DataOutput out) throws IOException
MessageLite.toByteArray() instead.WritableComparable interface
and is used for serialization of the HTableDescriptor over RPCwrite in interface org.apache.hadoop.io.WritableIOExceptionpublic int compareTo(HTableDescriptor other)
compareTo in interface Comparable<HTableDescriptor>public Collection<HColumnDescriptor> getFamilies()
HColumnDescriptor
of all the column families of the table.HColumnDescriptor of all the
column families.public Set<byte[]> getFamiliesKeys()
public HColumnDescriptor[] getColumnFamilies()
HColumnDescriptor of the column families
of the table.getFamilies()public HColumnDescriptor getFamily(byte[] column)
column - Column family namepublic HColumnDescriptor removeFamily(byte[] column)
column - Name of the column family to be removed.public void addCoprocessor(String className) throws IOException
RegionObserver
or Endpoint.
It won't check if the class can be loaded or not.
Whether a coprocessor is loadable or not will be determined when
a region is opened.className - Full class name.IOExceptionpublic void addCoprocessor(String className, org.apache.hadoop.fs.Path jarFilePath, int priority, Map<String,String> kvs) throws IOException
RegionObserver
or Endpoint.
It won't check if the class can be loaded or not.
Whether a coprocessor is loadable or not will be determined when
a region is opened.jarFilePath - Path of the jar file. If it's null, the class will be
loaded from default classloader.className - Full class name.priority - Prioritykvs - Arbitrary key-value parameter pairs passed into the coprocessor.IOExceptionpublic boolean hasCoprocessor(String className)
className - - Class name of the co-processorpublic List<String> getCoprocessors()
public void removeCoprocessor(String className)
className - Class name of the co-processor@Deprecated public static org.apache.hadoop.fs.Path getTableDir(org.apache.hadoop.fs.Path rootdir, byte[] tableName)
Path object representing the table directory under
path rootdir
Deprecated use FSUtils.getTableDir() instead.rootdir - qualified path of HBase root directorytableName - name of tablePath for table@Deprecated public void setOwner(User owner)
@Deprecated public void setOwnerString(String ownerString)
@Deprecated public String getOwnerString()
public byte[] toByteArray()
parseFrom(byte[])public static HTableDescriptor parseFrom(byte[] bytes) throws DeserializationException, IOException
bytes - A pb serialized HTableDescriptor instance with pb magic prefixHTableDescriptor made from bytesDeserializationExceptionIOExceptiontoByteArray()public HBaseProtos.TableSchema convert()
HTableDescriptor into a pb TableSchema instance.public static HTableDescriptor convert(HBaseProtos.TableSchema ts)
ts - A pb TableSchema instance.HTableDescriptor made from the passed in pb ts.public String getConfigurationValue(String key)
public Map<String,String> getConfiguration()
configuration map.public void setConfiguration(String key, String value)
configuration map.key - Config key. Same as XML config key e.g. hbase.something.or.other.value - String value. If null, removes the setting.public void removeConfiguration(String key)
configuration mapCopyright © 2014 The Apache Software Foundation. All rights reserved.