}
}
private void handleTruncateTable(String tableName) throws IOException,
ServiceException, KeeperException {
FMetaServices fmetaServices = FMetaReader.getService(server
.getConfiguration());
FTable ftable = FMetaReader.getTable(server.getConfiguration(),
tableNameStr);
// 1. delete storage table in HBase
String htablename = StorageTableNameBuilder.buildEntityTableName(ftable
.getTableName());
fmetaServices.deleteStorageTable(htablename);
// 2. create storage table in HBase
HTableDescriptor desc = fmetaServices.getStorageTableDesc(ftable);
fmetaServices.createStorageTable(desc);
// 3. delete Transaction table in HBase
List<EntityGroupInfo> eginfos = FMetaReader.getTableEntityGroups(
server.getConfiguration(), table);
for (EntityGroupInfo eginfo : eginfos) {
String tTableName = StorageTableNameBuilder
.buildTransactionTableName(eginfo.getEncodedName());
if (fmetaServices.storageTableExists(tTableName)) {
fmetaServices.deleteStorageTable(tTableName);
}
}
// 4. clean Index table in HBase
LinkedHashMap<String, Index> indexs = ftable.getIndex();
Iterator<Index> iter = indexs.values().iterator();
while (iter.hasNext()) {
Index index = iter.next();
String htable = StorageTableNameBuilder.buildIndexTableName(index);
HTableDescriptor htableDesc = fmetaServices.getStorageTableDesc(htable);
fmetaServices.deleteStorageTable(htable);
fmetaServices.createStorageTable(htableDesc);
}
// unlock table
tableLockManager.unlockTable(tableNameStr);
}