HBASE-1082 Administrative functions for table/region maintenance; Add byte array overloads for jgray

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@731987 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-01-06 16:22:59 +00:00
parent 8e047c5801
commit 7613afcf75
1 changed files with 43 additions and 7 deletions

View File

@ -547,6 +547,15 @@ public class HBaseAdmin {
* @throws IOException
*/
public void flush(final String tableNameOrRegionName) throws IOException {
flush(Bytes.toBytes(tableNameOrRegionName));
}
/**
* Flush a table or an individual region
* @param tableNameOrRegionName
* @throws IOException
*/
public void flush(final byte [] tableNameOrRegionName) throws IOException {
modifyTable(tableNameOrRegionName, HConstants.MODIFY_TABLE_FLUSH);
}
@ -556,6 +565,15 @@ public class HBaseAdmin {
* @throws IOException
*/
public void compact(final String tableNameOrRegionName) throws IOException {
compact(Bytes.toBytes(tableNameOrRegionName));
}
/**
* Compact a table or an individual region
* @param tableNameOrRegionName
* @throws IOException
*/
public void compact(final byte [] tableNameOrRegionName) throws IOException {
modifyTable(tableNameOrRegionName, HConstants.MODIFY_TABLE_COMPACT);
}
@ -565,6 +583,16 @@ public class HBaseAdmin {
* @throws IOException
*/
public void majorCompact(final String tableNameOrRegionName)
throws IOException {
majorCompact(Bytes.toBytes(tableNameOrRegionName));
}
/**
* Major compact a table or an individual region
* @param tableNameOrRegionName
* @throws IOException
*/
public void majorCompact(final byte [] tableNameOrRegionName)
throws IOException {
modifyTable(tableNameOrRegionName, HConstants.MODIFY_TABLE_MAJOR_COMPACT);
}
@ -575,9 +603,17 @@ public class HBaseAdmin {
* @throws IOException
*/
public void split(final String tableNameOrRegionName) throws IOException {
modifyTable(tableNameOrRegionName, HConstants.MODIFY_TABLE_SPLIT);
split(Bytes.toBytes(tableNameOrRegionName));
}
/**
* Split a table or an individual region
* @param tableNameOrRegionName
* @throws IOException
*/
public void split(final byte [] tableNameOrRegionName) throws IOException {
modifyTable(tableNameOrRegionName, HConstants.MODIFY_TABLE_SPLIT);
}
/*
* Call modifyTable using passed tableName or region name String. If no
@ -586,16 +622,16 @@ public class HBaseAdmin {
* @param op
* @throws IOException
*/
private void modifyTable(final String tableNameOrRegionName, final int op)
private void modifyTable(final byte [] tableNameOrRegionName, final int op)
throws IOException {
if (tableNameOrRegionName == null) {
throw new IllegalArgumentException("Pass a table name or region name");
}
String tableName = tableExists(tableNameOrRegionName)?
byte [] tableName = tableExists(tableNameOrRegionName)?
tableNameOrRegionName: null;
String regionName = tableName == null? tableNameOrRegionName: null;
Object [] args = regionName == null? null: new String [] {regionName};
modifyTable(tableName == null? null: Bytes.toBytes(tableName), op, args);
byte [] regionName = tableName == null? tableNameOrRegionName: null;
Object [] args = regionName == null? null: new byte [][] {regionName};
modifyTable(tableName == null? null: tableName, op, args);
}
/**