HBASE-3437 : Support Explict Split Points from the Shell
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1057799 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0d31ac5f37
commit
8d04c2b297
|
@ -1059,6 +1059,11 @@ public class HBaseAdmin implements Abortable {
|
||||||
split(tableNameOrRegionName, null);
|
split(tableNameOrRegionName, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void split(final String tableNameOrRegionName,
|
||||||
|
final String splitPoint) throws IOException, InterruptedException {
|
||||||
|
split(Bytes.toBytes(tableNameOrRegionName), Bytes.toBytes(splitPoint));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split a table or an individual region.
|
* Split a table or an individual region.
|
||||||
* Asynchronous operation.
|
* Asynchronous operation.
|
||||||
|
|
|
@ -1319,12 +1319,11 @@ public class Store implements HeapSize {
|
||||||
StoreSize checkSplit(final boolean force) {
|
StoreSize checkSplit(final boolean force) {
|
||||||
this.lock.readLock().lock();
|
this.lock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
// Iterate through all store files
|
// sanity checks
|
||||||
if (this.storefiles.isEmpty()) {
|
if (!force) {
|
||||||
|
if (storeSize < this.desiredMaxFileSize || this.storefiles.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!force && (storeSize < this.desiredMaxFileSize)) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.region.getRegionInfo().isMetaRegion()) {
|
if (this.region.getRegionInfo().isMetaRegion()) {
|
||||||
|
|
|
@ -61,8 +61,12 @@ module Hbase
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------
|
||||||
# Requests a table or region split
|
# Requests a table or region split
|
||||||
def split(table_or_region_name)
|
def split(table_or_region_name, split_point)
|
||||||
|
if split_point == nil
|
||||||
@admin.split(table_or_region_name)
|
@admin.split(table_or_region_name)
|
||||||
|
else
|
||||||
|
@admin.split(table_or_region_name, split_point)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -23,13 +23,19 @@ module Shell
|
||||||
class Split < Command
|
class Split < Command
|
||||||
def help
|
def help
|
||||||
return <<-EOF
|
return <<-EOF
|
||||||
Split table or pass a region row to split individual region
|
Split entire table or pass a region to split individual region. With the
|
||||||
|
second parameter, you can specify an explicit split key for the region.
|
||||||
|
Examples:
|
||||||
|
split 'tableName'
|
||||||
|
split 'regionName' # format: 'tableName,startKey,id'
|
||||||
|
split 'tableName', 'splitKey'
|
||||||
|
split 'regionName', 'splitKey'
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
|
|
||||||
def command(table_or_region_name)
|
def command(table_or_region_name, split_point = nil)
|
||||||
format_simple_command do
|
format_simple_command do
|
||||||
admin.split(table_or_region_name)
|
admin.split(table_or_region_name, split_point)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue