HBASE-1874 Client Scanner mechanism that is used for HbaseAdmin methods (listTables, tableExists), is very slow if the client is far away from the HBase cluster

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@820089 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-09-29 21:06:40 +00:00
parent 57f5eafe25
commit c2db3972ec
2 changed files with 14 additions and 5 deletions

View File

@ -87,6 +87,9 @@ Release 0.21.0 - Unreleased
HBASE-1855 HMaster web application doesn't show the region end key in the
table detail page (Andrei Dragomir via Stack)
HBASE-1870 Bytes.toFloat(byte[], int) is marked private
HBASE-1874 Client Scanner mechanism that is used for HbaseAdmin methods
(listTables, tableExists), is very slow if the client is far
away from the HBase cluster (Andrei Dragomir via Stack)
OPTIMIZATIONS

View File

@ -47,20 +47,26 @@ class MetaScanner implements HConstants {
// Scan over each meta region
ScannerCallable callable = null;
int rows = configuration.getInt("hbase.meta.scanner.caching", 100);
do {
Scan scan = new Scan(startRow).addFamily(CATALOG_FAMILY);
callable = new ScannerCallable(connection, META_TABLE_NAME, scan);
// Open scanner
connection.getRegionServerWithRetries(callable);
try {
Result r = null;
do {
callable.setCaching(rows);
done: do {
//we have all the rows here
Result [] rrs = connection.getRegionServerWithRetries(callable);
if (rrs == null || rrs.length == 0 || rrs[0].size() == 0) {
break;
break done; //exit completely
}
r = rrs[0];
} while(visitor.processRow(r));
for (int i = 0; i < rrs.length; i++) {
if (!visitor.processRow(rrs[i]))
break done; //exit completely
}
//here, we didn't break anywhere. Check if we have more rows
} while(true);
// Advance the startRow to the end key of the current region
startRow = callable.getHRegionInfo().getEndKey();
} finally {