|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.HTableDescriptor
@InterfaceAudience.Public @InterfaceStability.Evolving public class HTableDescriptor
HTableDescriptor contains the details about an HBase table such as the descriptors of
all the column families, is the table a catalog table, -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...
Field Summary | |
---|---|
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
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 |
OWNER
|
static ImmutableBytesWritable |
OWNER_KEY
|
static String |
PRIORITY
|
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
|
Constructor Summary | |
---|---|
|
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- . |
Method Summary | |
---|---|
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. |
HTableDescriptor |
addCoprocessorWithSpec(String specStr)
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. |
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. |
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. |
int |
getPriority()
|
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 |
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 |
metaTableDescriptor(org.apache.hadoop.conf.Configuration conf)
|
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. |
HTableDescriptor |
setPriority(int priority)
|
void |
setReadOnly(boolean readOnly)
Setting the table as read only sets all the columns in the table as read only. |
void |
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. |
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()
|
String |
toStringTableAttributes()
|
void |
write(DataOutput out)
Deprecated. Writables are going away. Use MessageLite.toByteArray() instead. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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 String PRIORITY
public static final boolean DEFAULT_READONLY
public static final boolean DEFAULT_COMPACTION_ENABLED
public static final long DEFAULT_MEMSTORE_FLUSH_SIZE
@Deprecated public static final HTableDescriptor META_TABLEDESC
hbase:meta
catalog table
public 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
Constructor Detail |
---|
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.Method Detail |
---|
public boolean isRootRegion()
-ROOT-
region.
-ROOT-
regionprotected void setRootRegion(boolean isRoot)
-ROOT-
region. This is used internally by the
HTableDescriptor constructors
isRoot
- 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 constructors
isMeta
- 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.
values
.values
public void setValue(byte[] key, byte[] value)
values
map
key
- The key.value
- The value.values
public void setValue(ImmutableBytesWritable key, ImmutableBytesWritable value)
public void setValue(String key, String value)
values
map
key
- The key.value
- The value.values
public void remove(String key)
values
map
key
- Key whose key and value we're to remove from HTableDescriptor
parameters.public void remove(ImmutableBytesWritable key)
values
map
key
- Key whose key and value we're to remove from HTableDescriptor
parameters.public void remove(byte[] key)
values
map
key
- 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 void setRegionSplitPolicyClassName(String clazz)
regionserver.RegionSplitPolicy
clazz
- the class namepublic String getRegionSplitPolicyClassName()
regionserver.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 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 RPC
readFields
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 RPC
write
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 HTableDescriptor setPriority(int priority)
public int getPriority()
public Set<byte[]> getFamiliesKeys()
public HColumnDescriptor[] getColumnFamilies()
HColumnDescriptor
of the column families
of the table.
getFamilies()
public HColumnDescriptor getFamily(byte[] column)
column
- Column family name
public HColumnDescriptor removeFamily(byte[] column)
column
- Name of the column family to be removed.
public void addCoprocessor(String className) throws IOException
coprocessor.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
coprocessor.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
coprocessor.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-processor
public 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 table
Path
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 prefix
HTableDescriptor
made from bytes
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 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
map
public static HTableDescriptor metaTableDescriptor(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |