本文整理匯總了Java中org.apache.hadoop.hbase.client.Admin.isTableDisabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Admin.isTableDisabled方法的具體用法?Java Admin.isTableDisabled怎麽用?Java Admin.isTableDisabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hbase.client.Admin
的用法示例。
在下文中一共展示了Admin.isTableDisabled方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: waitTableDisabled
import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
public void waitTableDisabled(Admin admin, byte[] table, long timeoutMillis)
throws InterruptedException, IOException {
TableName tableName = TableName.valueOf(table);
long startWait = System.currentTimeMillis();
while (!admin.isTableDisabled(tableName)) {
assertTrue("Timed out waiting for table to become disabled " +
Bytes.toStringBinary(table),
System.currentTimeMillis() - startWait < timeoutMillis);
Thread.sleep(200);
}
}
示例2: merge
import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
/**
* Scans the table and merges two adjacent regions if they are small. This
* only happens when a lot of rows are deleted.
*
* When merging the hbase:meta region, the HBase instance must be offline.
* When merging a normal table, the HBase instance must be online, but the
* table must be disabled.
*
* @param conf - configuration object for HBase
* @param fs - FileSystem where regions reside
* @param tableName - Table to be compacted
* @param testMasterRunning True if we are to verify master is down before
* running merge
* @throws IOException
*/
public static void merge(Configuration conf, FileSystem fs,
final TableName tableName, final boolean testMasterRunning)
throws IOException {
boolean masterIsRunning = false;
if (testMasterRunning) {
masterIsRunning = HConnectionManager
.execute(new HConnectable<Boolean>(conf) {
@Override
public Boolean connect(HConnection connection) throws IOException {
return connection.isMasterRunning();
}
});
}
if (tableName.equals(TableName.META_TABLE_NAME)) {
if (masterIsRunning) {
throw new IllegalStateException(
"Can not compact hbase:meta table if instance is on-line");
}
// TODO reenable new OfflineMerger(conf, fs).process();
} else {
if(!masterIsRunning) {
throw new IllegalStateException(
"HBase instance must be running to merge a normal table");
}
Admin admin = new HBaseAdmin(conf);
try {
if (!admin.isTableDisabled(tableName)) {
throw new TableNotDisabledException(tableName);
}
} finally {
admin.close();
}
new OnlineMerger(conf, fs, tableName).process();
}
}
示例3: truncateTable
import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
/**
* Truncate a table using the admin command.
* Effectively disables, deletes, and recreates the table.
* @param tableName table which must exist.
* @param preserveRegions keep the existing split points
* @return HTable for the new table
*/
public HTable truncateTable(final TableName tableName, final boolean preserveRegions)
throws IOException {
Admin admin = getHBaseAdmin();
if (!admin.isTableDisabled(tableName)) {
admin.disableTable(tableName);
}
admin.truncateTable(tableName, preserveRegions);
return new HTable(getConfiguration(), tableName);
}