public void alterTable(String tableName, FTable newFTable)
throws MetaException {
byte[] rowKey = Bytes.toBytes(FConstants.TABLEROW_PREFIX_STR + tableName);
Get get = new Get(rowKey);
if (!exists(get)) {
throw new MetaException(tableName + " is not exists.");
}
if (tableName.equals(newFTable.getTableName())) {
Put put = new Put(rowKey);
put.add(FConstants.CATALOG_FAMILY, FConstants.TABLEINFO,
newFTable.toByte());
put(put);
} else {
// rename (1) tableName exists (2)newFTable.getTableName() is not exists
rowKey = Bytes.toBytes(FConstants.TABLEROW_PREFIX_STR
+ newFTable.getTableName());
get = new Get(rowKey);
if (exists(get)) {
throw new MetaException(tableName + " is already exists.");
}
// put into a new row
Put put = new Put(rowKey);
put.add(FConstants.CATALOG_FAMILY, FConstants.TABLEINFO,
newFTable.toByte());