You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2009/09/29 23:06:40 UTC

svn commit: r820089 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/client/MetaScanner.java

Author: stack
Date: Tue Sep 29 21:06:40 2009
New Revision: 820089

URL: http://svn.apache.org/viewvc?rev=820089&view=rev
Log:
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

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/MetaScanner.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=820089&r1=820088&r2=820089&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Tue Sep 29 21:06:40 2009
@@ -87,6 +87,9 @@
    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
 

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/MetaScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/MetaScanner.java?rev=820089&r1=820088&r2=820089&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/MetaScanner.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/MetaScanner.java Tue Sep 29 21:06:40 2009
@@ -47,20 +47,26 @@
       
     // 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 {