HBASE-3612 HBaseAdmin::isTableAvailable returns true when the table does not exit

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1080397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2011-03-10 23:41:28 +00:00
parent 79eb3c26a2
commit d86e7e1c18
2 changed files with 6 additions and 1 deletions

View File

@ -62,6 +62,8 @@ Release 0.91.0 - Unreleased
on OOME
HBASE-1960 Master should wait for DFS to come up when creating
hbase.version; use alternate strategy for waiting for DNs
HBASE-3612 HBaseAdmin::isTableAvailable returns true when the table does
not exit
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -31,6 +31,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -443,6 +444,7 @@ public class HConnectionManager {
public boolean isTableAvailable(final byte[] tableName) throws IOException {
final AtomicBoolean available = new AtomicBoolean(true);
final AtomicInteger regionCount = new AtomicInteger(0);
MetaScannerVisitor visitor = new MetaScannerVisitor() {
@Override
public boolean processRow(Result row) throws IOException {
@ -457,13 +459,14 @@ public class HConnectionManager {
available.set(false);
return false;
}
regionCount.incrementAndGet();
}
}
return true;
}
};
MetaScanner.metaScan(conf, visitor);
return available.get();
return available.get() && (regionCount.get() > 0);
}
/*