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:
parent
79eb3c26a2
commit
d86e7e1c18
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue