@InterfaceAudience.Private public abstract class RegionSplitRestriction extends Object
The difference between RegionSplitPolicy
and RegionSplitRestriction is that
RegionSplitRestriction defines how to split while RegionSplitPolicy
defines when we need
to split.
We can specify a split restriction, "KeyPrefix" or "DelimitedKeyPrefix", to a table with the "hbase.regionserver.region.split_restriction.type" property. The "KeyPrefix" split restriction groups rows by a prefix of the row-key. And the "DelimitedKeyPrefix" split restriction groups rows by a prefix of the row-key with a delimiter. For example:
# Create a table with a "KeyPrefix" split restriction, where the prefix length is 2 bytes
hbase> create 'tbl1', 'fam',
{CONFIGURATION => {'hbase.regionserver.region.split_restriction.type' => 'KeyPrefix',
'hbase.regionserver.region.split_restriction.prefix_length' => '2'}}
# Create a table with a "DelimitedKeyPrefix" split restriction, where the delimiter is a comma
hbase> create 'tbl2', 'fam',
{CONFIGURATION => {'hbase.regionserver.region.split_restriction.type' => 'DelimitedKeyPrefix',
'hbase.regionserver.region.split_restriction.delimiter' => ','}}
Instead of specifying a split restriction to a table directly, we can also set the properties in
hbase-site.xml. In this case, the specified split restriction is applied for all the tables.
Note that the split restriction is also applied to a user-specified split point so that we don't allow users to break the restriction.
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
static String |
RESTRICTION_TYPE_DELIMITED_KEY_PREFIX |
static String |
RESTRICTION_TYPE_KEY |
static String |
RESTRICTION_TYPE_KEY_PREFIX |
static String |
RESTRICTION_TYPE_NONE |
Constructor and Description |
---|
RegionSplitRestriction() |
Modifier and Type | Method and Description |
---|---|
static RegionSplitRestriction |
create(TableDescriptor tableDescriptor,
org.apache.hadoop.conf.Configuration conf)
Create the RegionSplitRestriction configured for the given table.
|
abstract byte[] |
getRestrictedSplitPoint(byte[] splitPoint)
Returns a restricted split point.
|
abstract void |
initialize(TableDescriptor tableDescriptor,
org.apache.hadoop.conf.Configuration conf)
Initialize the RegionSplitRestriction instance
|
private static final org.slf4j.Logger LOG
public static final String RESTRICTION_TYPE_KEY
public static final String RESTRICTION_TYPE_NONE
public static final String RESTRICTION_TYPE_KEY_PREFIX
public static final String RESTRICTION_TYPE_DELIMITED_KEY_PREFIX
public RegionSplitRestriction()
public static RegionSplitRestriction create(TableDescriptor tableDescriptor, org.apache.hadoop.conf.Configuration conf) throws IOException
tableDescriptor
- the table descriptorconf
- the configurationIOException
- if an error occurspublic abstract void initialize(TableDescriptor tableDescriptor, org.apache.hadoop.conf.Configuration conf) throws IOException
tableDescriptor
- the table descriptorconf
- the configurationIOException
- if an error occurspublic abstract byte[] getRestrictedSplitPoint(byte[] splitPoint)
splitPoint
- the split point determined by RegionSplitPolicy
or specified by a
user manuallyCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.