hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r671731 - in /hadoop/hbase/trunk/src: java/org/apache/hadoop/hbase/client/HTable.java java/org/apache/hadoop/hbase/regionserver/HRegionServer.java test/org/apache/hadoop/hbase/util/TestMergeTool.java
Date Thu, 26 Jun 2008 04:50:55 GMT
Author: jimk
Date: Wed Jun 25 21:50:54 2008
New Revision: 671731

URL: http://svn.apache.org/viewvc?rev=671731&view=rev
Log:
HBASE-613   Timestamp-anchored scanning fails to find all records

Three problems:
- HRegionServer.next did not return null if there were no results
- HTable$ClientScanner.next had wrong loop termination
- TestMergeTool did not correctly set fs, hbase.rootdir

Modified:
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/TestMergeTool.java

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java?rev=671731&r1=671730&r2=671731&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java Wed Jun 25 21:50:54
2008
@@ -1343,8 +1343,8 @@
       byte [] localStartKey = oldRegion == null? startRow: oldRegion.getEndKey();
 
       if (CLIENT_LOG.isDebugEnabled()) {
-        CLIENT_LOG.debug("Advancing internal scanner to startKey at " +
-          Bytes.toString(localStartKey));
+        CLIENT_LOG.debug("Advancing internal scanner to startKey at '" +
+          Bytes.toString(localStartKey) + "'");
       }
             
       try {
@@ -1387,7 +1387,7 @@
       RowResult values = null;
       do {
         values = getConnection().getRegionServerWithRetries(callable);
-      } while (values != null && values.size() == 0 && nextScanner());
+      } while ((values == null || values.size() == 0) && nextScanner());
 
       if (values != null && values.size() != 0) {
         return values;

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=671731&r1=671730&r2=671731&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Wed
Jun 25 21:50:54 2008
@@ -1128,7 +1128,7 @@
         // No data for this row, go get another.
         results.clear();
       }
-      return new RowResult(key.getRow(), values);
+      return values.size() == 0 ? null : new RowResult(key.getRow(), values);
     } catch (IOException e) {
       checkFileSystem();
       throw e;

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/TestMergeTool.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/TestMergeTool.java?rev=671731&r1=671730&r2=671731&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/TestMergeTool.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/TestMergeTool.java Wed Jun 25
21:50:54 2008
@@ -25,7 +25,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.dfs.MiniDFSCluster;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -48,7 +47,6 @@
   private HTableDescriptor desc;
   private byte [][][] rows;
   private MiniDFSCluster dfsCluster = null;
-  private FileSystem fs;
   
   /** {@inheritDoc} */
   @Override
@@ -101,13 +99,19 @@
     // Start up dfs
     this.dfsCluster = new MiniDFSCluster(conf, 2, true, (String[])null);
     this.fs = this.dfsCluster.getFileSystem();
-    
+    conf.set("fs.default.name", fs.getUri().toString());
+    Path parentdir = fs.getHomeDirectory();
+    conf.set(HConstants.HBASE_DIR, parentdir.toString());
+    fs.mkdirs(parentdir);
+    FSUtils.setVersion(fs, parentdir);
+
     // Note: we must call super.setUp after starting the mini cluster or
     // we will end up with a local file system
     
     super.setUp();
-
     try {
+      // Create root and meta regions
+      createRootAndMetaRegions();
       /*
        * Create the regions we will merge
        */
@@ -123,11 +127,6 @@
           b.put(COLUMN_NAME, new ImmutableBytesWritable(row).get());
           regions[i].batchUpdate(b);
         }
-      }
-      // Create root and meta regions
-      createRootAndMetaRegions();
-      // Insert the regions we created into the meta
-      for(int i = 0; i < regions.length; i++) {
         HRegion.addRegionToMETA(meta, regions[i]);
       }
       // Close root and meta regions



Mime
View raw message