@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_NORMALIZATION_ENABLED
Constant that denotes whether the table is normalized by default.
|
static boolean |
DEFAULT_READONLY
Constant that denotes whether the table is READONLY by default and is false
|
static boolean |
DEFAULT_REGION_MEMSTORE_REPLICATION |
static int |
DEFAULT_REGION_REPLICATION |
static String |
DEFERRED_LOG_FLUSH
Deprecated.
Use
DURABILITY instead. |
static String |
DURABILITY
INTERNAL
Durability setting for the table. |
static String |
FLUSH_POLICY |
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
Deprecated.
Use TableDescriptors#get(TableName.META_TABLE_NAME) or
HBaseAdmin#getTableDescriptor(TableName.META_TABLE_NAME) instead.
|
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 |
NORMALIZATION_ENABLED
INTERNAL Used by shell/rest interface to access this metadata
attribute which denotes if the table should be treated by region normalizer.
|
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 |
REGION_MEMSTORE_REPLICATION
INTERNAL flag to indicate whether or not the memstore should be replicated
for read-replicas (CONSISTENCY => TIMELINE).
|
static String |
REGION_REPLICATION
INTERNAL number of region replicas for the table.
|
static String |
SPLIT_POLICY |
Modifier | Constructor and Description |
---|---|
|
HTableDescriptor()
Deprecated.
As of release 0.96
(HBASE-5453).
This will be removed in HBase 2.0.0.
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- . |
|
HTableDescriptor(TableName name,
HTableDescriptor desc)
Construct a table descriptor by cloning the descriptor passed as a parameter
but using a different table name.
|
Modifier and Type | Method and Description |
---|---|
HTableDescriptor |
addCoprocessor(String className)
Add a table coprocessor to this table.
|
HTableDescriptor |
addCoprocessor(String className,
org.apache.hadoop.fs.Path jarFilePath,
int priority,
Map<String,String> kvs)
Add a table coprocessor to this table.
|
HTableDescriptor |
addCoprocessorWithSpec(String specStr)
Add a table coprocessor to this table.
|
HTableDescriptor |
addFamily(HColumnDescriptor family)
Adds a column family.
|
int |
compareTo(HTableDescriptor other)
Compares the descriptor with another descriptor which is passed as a parameter.
|
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema |
convert() |
static HTableDescriptor |
convert(org.apache.hadoop.hbase.protobuf.generated.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.
|
String |
getFlushPolicyClassName()
This gets the class associated with the flush policy which determines the stores need to be
flushed when flushing a region.
|
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()
Deprecated.
Use
getTableName() instead |
String |
getNameAsString()
Get the name of the table as a String
|
String |
getOwnerString()
Deprecated.
|
int |
getRegionReplication()
Returns the configured replicas per region
|
String |
getRegionSplitPolicyClassName()
This gets 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 classNameToMatch)
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 |
hasRegionMemstoreReplication() |
boolean |
isCompactionEnabled()
Check if the compaction enable flag of the table is true.
|
boolean |
isMetaRegion()
Checks if this table is
hbase:meta
region. |
boolean |
isMetaTable()
Checks if the table is a
hbase:meta table |
boolean |
isNormalizationEnabled()
Check if normalization enable flag of the table is true.
|
boolean |
isReadOnly()
Check if the readOnly flag of the table is set.
|
boolean |
isRootRegion()
Check if the descriptor represents a
-ROOT- region. |
static HTableDescriptor |
metaTableDescriptor(org.apache.hadoop.conf.Configuration conf) |
HTableDescriptor |
modifyFamily(HColumnDescriptor family)
Modifies the existing column family.
|
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
|
HTableDescriptor |
setCompactionEnabled(boolean isEnable)
Setting the table compaction enable flag.
|
HTableDescriptor |
setConfiguration(String key,
String value)
Setter for storing a configuration setting in
configuration map. |
HTableDescriptor |
setDurability(Durability durability)
Sets the
Durability setting for the table. |
HTableDescriptor |
setFlushPolicyClassName(String clazz)
This sets the class associated with the flush policy which determines determines the stores
need to be flushed when flushing a region.
|
HTableDescriptor |
setMaxFileSize(long maxFileSize)
Sets the maximum size upto which a region can grow to after which a region
split is triggered.
|
HTableDescriptor |
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. |
HTableDescriptor |
setName(byte[] name)
Deprecated.
|
HTableDescriptor |
setName(TableName name)
Deprecated.
|
HTableDescriptor |
setNormalizationEnabled(boolean isEnable)
Setting the table normalization enable flag.
|
HTableDescriptor |
setOwner(User owner)
Deprecated.
|
HTableDescriptor |
setOwnerString(String ownerString)
Deprecated.
|
HTableDescriptor |
setReadOnly(boolean readOnly)
Setting the table as read only sets all the columns in the table as read
only.
|
HTableDescriptor |
setRegionMemstoreReplication(boolean memstoreReplication)
Enable or Disable the memstore replication from the primary region to the replicas.
|
HTableDescriptor |
setRegionReplication(int regionReplication)
Sets the number of replicas per region.
|
HTableDescriptor |
setRegionSplitPolicyClassName(String clazz)
This sets the class associated with the region split policy which
determines when a region split should occur.
|
protected void |
setRootRegion(boolean isRoot)
INTERNAL Used to denote if the current table represents
-ROOT- region. |
HTableDescriptor |
setValue(byte[] key,
byte[] value)
Setter for storing metadata as a (key, value) pair in
values map |
HTableDescriptor |
setValue(ImmutableBytesWritable key,
ImmutableBytesWritable value) |
HTableDescriptor |
setValue(String key,
String value)
Setter for storing metadata as a (key, value) pair in
values map |
byte[] |
toByteArray() |
String |
toString() |
String |
toStringCustomizedValues() |
String |
toStringTableAttributes() |
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 FLUSH_POLICY
public 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 String REGION_REPLICATION
public static final String REGION_MEMSTORE_REPLICATION
public static final String NORMALIZATION_ENABLED
public static final boolean DEFAULT_READONLY
public static final boolean DEFAULT_COMPACTION_ENABLED
public static final boolean DEFAULT_NORMALIZATION_ENABLED
public static final long DEFAULT_MEMSTORE_FLUSH_SIZE
public static final int DEFAULT_REGION_REPLICATION
public static final boolean DEFAULT_REGION_MEMSTORE_REPLICATION
@Deprecated 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
@InterfaceAudience.Private 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 HTableDescriptor(TableName name, HTableDescriptor desc)
Makes a deep copy of the supplied descriptor. Can make a modifiable descriptor from an UnmodifyableHTableDescriptor.
name
- Table name.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.values
public String getValue(String key)
key
- The key.values
public Map<ImmutableBytesWritable,ImmutableBytesWritable> getValues()
values
map.public HTableDescriptor setValue(byte[] key, byte[] value)
values
mapkey
- The key.value
- The value.values
public HTableDescriptor setValue(ImmutableBytesWritable key, ImmutableBytesWritable value)
public HTableDescriptor setValue(String key, String value)
values
mapkey
- The key.value
- The value.values
public 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 HTableDescriptor setReadOnly(boolean readOnly)
readOnly
- True if all of the columns in the table should be read
only.public boolean isCompactionEnabled()
public HTableDescriptor setCompactionEnabled(boolean isEnable)
isEnable
- True if enable compaction.public boolean isNormalizationEnabled()
public HTableDescriptor setNormalizationEnabled(boolean isEnable)
isEnable
- True if enable normalization.public HTableDescriptor setDurability(Durability durability)
Durability
setting for the table. This defaults to Durability.USE_DEFAULT.durability
- enum valuepublic Durability getDurability()
public TableName getTableName()
@Deprecated public byte[] getName()
getTableName()
insteadpublic String getNameAsString()
public HTableDescriptor setRegionSplitPolicyClassName(String clazz)
RegionSplitPolicy
clazz
- the class namepublic String getRegionSplitPolicyClassName()
RegionSplitPolicy
@Deprecated public HTableDescriptor setName(byte[] name)
name
- name of table@Deprecated public HTableDescriptor setName(TableName name)
public long getMaxFileSize()
setMaxFileSize(long)
public HTableDescriptor 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 HTableDescriptor setMemStoreFlushSize(long memstoreFlushSize)
memstoreFlushSize
- memory cache flush size for each hregionpublic HTableDescriptor setFlushPolicyClassName(String clazz)
FlushPolicy
clazz
- the class namepublic String getFlushPolicyClassName()
FlushPolicy
public HTableDescriptor addFamily(HColumnDescriptor family)
modifyFamily(HColumnDescriptor)
instead.family
- HColumnDescriptor of family to add.public HTableDescriptor modifyFamily(HColumnDescriptor family)
family
- HColumnDescriptor of family to updatepublic boolean hasFamily(byte[] familyName)
familyName
- Family name or column name.public String toString()
toString
in class Object
getNameAsString()
public String toStringCustomizedValues()
public String toStringTableAttributes()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.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.Writable
IOException
@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.Writable
IOException
public 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 int getRegionReplication()
public HTableDescriptor setRegionReplication(int regionReplication)
regionReplication
- the replication factor per regionpublic boolean hasRegionMemstoreReplication()
public HTableDescriptor setRegionMemstoreReplication(boolean memstoreReplication)
memstoreReplication
- true if the new data written to the primary region
should be replicated.
false if the secondaries can tollerate to have new
data only when the primary flushes the memstore.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 HTableDescriptor 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.IOException
public HTableDescriptor 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.IOException
public HTableDescriptor addCoprocessorWithSpec(String specStr) 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.specStr
- The Coprocessor specification all in in one String formatted so matches
HConstants.CP_HTD_ATTR_VALUE_PATTERN
IOException
public boolean hasCoprocessor(String classNameToMatch)
classNameToMatch
- - 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 HTableDescriptor setOwner(User owner)
@Deprecated public HTableDescriptor setOwnerString(String ownerString)
@Deprecated public String getOwnerString()
public byte[] toByteArray()
parseFrom(byte[])
public static HTableDescriptor parseFrom(byte[] bytes) throws org.apache.hadoop.hbase.exceptions.DeserializationException, IOException
bytes
- A pb serialized HTableDescriptor
instance with pb magic prefixHTableDescriptor
made from bytes
org.apache.hadoop.hbase.exceptions.DeserializationException
IOException
toByteArray()
public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema convert()
HTableDescriptor
into a pb TableSchema instance.public static HTableDescriptor convert(org.apache.hadoop.hbase.protobuf.generated.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 HTableDescriptor 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
mappublic static HTableDescriptor metaTableDescriptor(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.