HBASE-5894 Table deletion failed but HBaseAdmin#deletetable reports it as success (Xufeng)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1334464 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-05-05 18:20:54 +00:00
parent 007d6da28c
commit 9c8d4067ce
1 changed files with 7 additions and 1 deletions

View File

@ -510,6 +510,7 @@ public class HBaseAdmin implements Abortable, Closeable {
public void deleteTable(final byte [] tableName) throws IOException {
HTableDescriptor.isLegalTableName(tableName);
HRegionLocation firstMetaServer = getFirstMetaServerForTable(tableName);
boolean tableExists = true;
execute(new MasterCallable<Void>() {
@Override
@ -541,7 +542,7 @@ public class HBaseAdmin implements Abortable, Closeable {
// let us wait until .META. table is updated and
// HMaster removes the table from its HTableDescriptors
if (values == null || values.length == 0) {
boolean tableExists = false;
tableExists = false;
HTableDescriptor[] htds;
MasterKeepAliveConnection master = connection.getKeepAliveMaster();
try {
@ -576,6 +577,11 @@ public class HBaseAdmin implements Abortable, Closeable {
// continue
}
}
if (tableExists) {
throw new IOException("Retries exhausted, it took too long to wait"+
" for the table " + Bytes.toString(tableName) + " to be deleted.");
}
// Delete cached information to prevent clients from using old locations
this.connection.clearRegionCache(tableName);
LOG.info("Deleted " + Bytes.toString(tableName));