소스 검색

HADOOP-2631 2443 breaks HTable.getStartKeys when there is more than one table
or table you are enumerating isn't the first table


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@616505 13f79535-47bb-0310-9956-ffa450edef68

Michael Stack 17 년 전
부모
커밋
eb90fc038f

+ 2 - 0
src/contrib/hbase/CHANGES.txt

@@ -155,6 +155,8 @@ Trunk (unreleased changes)
    HADOOP-2718 Copy Constructor HBaseConfiguration(Configuration) will override
                hbase configurations if argumant is not an instance of
                HBaseConfiguration.
+   HADOOP-2631 2443 breaks HTable.getStartKeys when there is more than one
+               table or table you are enumerating isn't the first table
    
   IMPROVEMENTS
    HADOOP-2401 Add convenience put method that takes writable

+ 9 - 7
src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTable.java

@@ -197,7 +197,8 @@ public class HTable implements HConstants {
 
     Text startRow = new Text(tableName.toString() + ",,999999999999999");
     HRegionLocation metaLocation = null;
-
+    HRegionInterface server;
+    
     // scan over the each meta region
     do {
       try{
@@ -206,13 +207,13 @@ public class HTable implements HConstants {
           connection.locateRegion(META_TABLE_NAME, startRow);
 
         // connect to the server hosting the .META. region
-        HRegionInterface server = 
+        server = 
           connection.getHRegionConnection(metaLocation.getServerAddress());
 
         // open a scanner over the meta region
         scannerId = server.openScanner(
           metaLocation.getRegionInfo().getRegionName(),
-          COLUMN_FAMILY_ARRAY, EMPTY_START_ROW, LATEST_TIMESTAMP,
+          COLUMN_FAMILY_ARRAY, tableName, LATEST_TIMESTAMP,
           null);
         
         // iterate through the scanner, accumulating unique table names
@@ -233,19 +234,20 @@ public class HTable implements HConstants {
               }
 
               if (info.isOffline()) {
-                LOG.debug("Region " + info + " was offline!");
-                break;
+                continue SCANNER_LOOP;
               }
 
               if (info.isSplit()) {
-                LOG.debug("Region " + info + " was split!");
-                break;
+                continue SCANNER_LOOP;
               }
 
               keyList.add(info.getStartKey());
             }
           }
         }
+        
+        // close that remote scanner
+        server.close(scannerId);
           
         // advance the startRow to the end key of the current region
         startRow = metaLocation.getRegionInfo().getEndKey();          

+ 1 - 1
src/contrib/hbase/src/test/org/apache/hadoop/hbase/MultiRegionTable.java

@@ -311,7 +311,7 @@ public class MultiRegionTable extends HBaseTestCase {
    * @param r
    * @throws IOException
    */
-  private static void compact(final MiniHBaseCluster cluster,
+  protected static void compact(final MiniHBaseCluster cluster,
       final HRegionInfo r)
   throws IOException {
     if (r == null) {