Class RegionSplitRestriction
java.lang.Object
org.apache.hadoop.hbase.regionserver.RegionSplitRestriction
- Direct Known Subclasses:
DelimitedKeyPrefixRegionSplitRestriction
,KeyPrefixRegionSplitRestriction
,NoRegionSplitRestriction
A split restriction that restricts the pattern of the split point.
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.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
-
Field Details
-
LOG
-
RESTRICTION_TYPE_KEY
- See Also:
-
RESTRICTION_TYPE_NONE
- See Also:
-
RESTRICTION_TYPE_KEY_PREFIX
- See Also:
-
RESTRICTION_TYPE_DELIMITED_KEY_PREFIX
- See Also:
-
-
Constructor Details
-
RegionSplitRestriction
public RegionSplitRestriction()
-
-
Method Details
-
create
public static RegionSplitRestriction create(TableDescriptor tableDescriptor, org.apache.hadoop.conf.Configuration conf) throws IOException Create the RegionSplitRestriction configured for the given table.- Parameters:
tableDescriptor
- the table descriptorconf
- the configuration- Returns:
- a RegionSplitRestriction instance
- Throws:
IOException
- if an error occurs
-
initialize
public abstract void initialize(TableDescriptor tableDescriptor, org.apache.hadoop.conf.Configuration conf) throws IOException Initialize the RegionSplitRestriction instance- Parameters:
tableDescriptor
- the table descriptorconf
- the configuration- Throws:
IOException
- if an error occurs
-
getRestrictedSplitPoint
Returns a restricted split point.- Parameters:
splitPoint
- the split point determined byRegionSplitPolicy
or specified by a user manually- Returns:
- the restricted split point
-