public class HTableDescriptor extends Object implements org.apache.hadoop.io.WritableComparable<HTableDescriptor>
-ROOT-
or
.META.
, is 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 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
INTERNAL Used by HBase Shell interface to access this metadata
attribute which denotes if the deferred log flush option is enabled
|
static String |
IS_META
INTERNAL Used by rest interface to access this metadata
attribute which denotes if it is a catalog table, either
.META. |
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
.META. catalog 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 HTableDescriptor |
ROOT_TABLEDESC
Table descriptor for
|
static String |
SPLIT_POLICY |
static String |
VALID_USER_TABLE_REGEX |
protected Map<ImmutableBytesWritable,ImmutableBytesWritable> |
values
A map which holds the metadata information of the table.
|
Modifier | Constructor and Description |
---|---|
|
HTableDescriptor()
Default constructor which constructs an empty object.
|
|
HTableDescriptor(byte[] name)
Construct a table descriptor specifying a byte array table name
|
protected |
HTableDescriptor(byte[] name,
HColumnDescriptor[] families)
INTERNAL Private constructor used internally creating table descriptors for
catalog tables,
.META. and -ROOT- . |
protected |
HTableDescriptor(byte[] name,
HColumnDescriptor[] families,
Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
INTERNAL Private constructor used internally creating table descriptors for
catalog tables,
.META. and -ROOT- . |
|
HTableDescriptor(HTableDescriptor desc)
Construct a table descriptor by cloning the descriptor passed as a parameter.
|
|
HTableDescriptor(String name)
Construct a table descriptor specifying table name.
|
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.
|
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. |
List<String> |
getCoprocessors()
Return the list of attached co-processor represented by their name className
|
static Map<String,String> |
getDefaultValues() |
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)
Returns the
Path object representing the table directory under
path rootdir |
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 |
isDeferredLogFlush()
Check if deferred log edits are enabled on the table.
|
static byte[] |
isLegalTableName(byte[] tableName) |
static byte[] |
isLegalTableName(byte[] tableName,
boolean isSnapshot)
Check passed byte buffer, "tableName", is legal user-space table name.
|
boolean |
isMetaRegion()
Checks if this table is either
-ROOT- or .META. |
boolean |
isMetaTable()
Checks if the table is a
.META. table |
static boolean |
isMetaTable(byte[] tableName)
Checks of the tableName being passed represents either
-ROOT- or .META. |
boolean |
isReadOnly()
Check if the readOnly flag of the table is set.
|
boolean |
isRootRegion()
Check if the descriptor represents a
-ROOT- region. |
void |
readFields(DataInput in)
INTERNAL This method is a part of
WritableComparable interface
and is used for de-serialization of the HTableDescriptor over RPC |
void |
remove(byte[] 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 |
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 |
setDeferredLogFlush(boolean isDeferredLogFlush)
This is used to defer the log edits syncing to the file system.
|
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 .META. |
void |
setName(byte[] name)
Set the name of the table.
|
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 |
String |
toString() |
String |
toStringCustomizedValues() |
void |
write(DataOutput out)
INTERNAL This method is a part of
WritableComparable interface
and is used for serialization of the HTableDescriptor over RPC |
protected final Map<ImmutableBytesWritable,ImmutableBytesWritable> values
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 MEMSTORE_FLUSHSIZE
getMemStoreFlushSize()
,
Constant Field Valuespublic static final String IS_ROOT
isRootRegion()
,
Constant Field Valuespublic static final String IS_META
.META.
or -ROOT-
isMetaRegion()
,
Constant Field Valuespublic static final String DEFERRED_LOG_FLUSH
public static final boolean DEFAULT_READONLY
public static final long DEFAULT_MEMSTORE_FLUSH_SIZE
public static final String VALID_USER_TABLE_REGEX
public static final HTableDescriptor ROOT_TABLEDESC
public static final HTableDescriptor META_TABLEDESC
.META.
catalog tableprotected HTableDescriptor(byte[] name, HColumnDescriptor[] families)
.META.
and -ROOT-
.protected HTableDescriptor(byte[] name, HColumnDescriptor[] families, Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
.META.
and -ROOT-
.public HTableDescriptor()
HTableDescriptor(byte[])
public HTableDescriptor(String name)
name
- Table name.IllegalArgumentException
- if passed a table name
that is made of other than 'word' characters, underscore or period: i.e.
[a-zA-Z_0-9.].
public HTableDescriptor(byte[] name)
name
- - Table name as a byte array.IllegalArgumentException
- if passed a table name
that is made of other than 'word' characters, underscore or period: i.e.
[a-zA-Z_0-9-.].
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()
-ROOT-
or .META.
region. -ROOT-
or .META.
regionprotected void setMetaRegion(boolean isMeta)
-ROOT-
or .META.
region. This is used
internally by the HTableDescriptor constructorsisMeta
- true if its either -ROOT-
or
.META.
regionpublic boolean isMetaTable()
.META.
table .META.
region.public static boolean isMetaTable(byte[] tableName)
-ROOT-
or .META.
-ROOT-
or .META.
public static byte[] isLegalTableName(byte[] tableName)
public static byte[] isLegalTableName(byte[] tableName, boolean isSnapshot)
tableName
paramNullPointerException
- If passed tableName
is nullIllegalArgumentException
- if passed a tableName
that is made of other than 'word' characters or underscores: i.e.
[a-zA-Z_0-9].
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 void setValue(byte[] key, byte[] value)
values
mapkey
- The key.value
- The value.values
public void setValue(ImmutableBytesWritable key, ImmutableBytesWritable value)
public void setValue(String key, String value)
values
mapkey
- The key.value
- The value.values
public void remove(byte[] key)
values
mapkey
- Key whose key and value we're to remove from HTableDescriptor
parameters.public void remove(String 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 isDeferredLogFlush()
setDeferredLogFlush(boolean)
public void setDeferredLogFlush(boolean isDeferredLogFlush)
hbase.regionserver.optionallogflushinterval
and not flushed
for every edit.
NOTE:- This option might result in data loss if the region server crashes before these deferred edits in memory are flushed onto the filesystem.
isDeferredLogFlush
- public byte[] getName()
public String getNameAsString()
public String getRegionSplitPolicyClassName()
ConstantSizeRegionSplitPolicy
which split the region base on a constant getMaxFileSize()
public void setName(byte[] name)
name
- name of tablepublic 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 Object
getNameAsString()
public String toStringCustomizedValues()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public void readFields(DataInput in) throws IOException
WritableComparable
interface
and is used for de-serialization of the HTableDescriptor over RPCreadFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
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 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.IOException
public 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.IOException
public 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-processorpublic static org.apache.hadoop.fs.Path getTableDir(org.apache.hadoop.fs.Path rootdir, byte[] tableName)
Path
object representing the table directory under
path rootdirrootdir
- 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()
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.