You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 19:45:27 UTC

svn commit: r1181980 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java

Author: nspiegelberg
Date: Tue Oct 11 17:45:26 2011
New Revision: 1181980

URL: http://svn.apache.org/viewvc?rev=1181980&view=rev
Log:
HBASE-4434: Don't do HFile Scanner next() unless the next KV is needed

Summary:
StoreFileScanner does HFileScanner.next() ahead of time even if the next KV is
never actually required.

Change itself seems simple, so putting it out there for review. Haven't run
much unit tests yet.

Test Plan:
1) running unit tests first...

2) will also run the set of tests we are adding for other related optimizations
we are working on, namely:
   * Lazy Seeks
   * INCLUDE_AND_SEEK_NEXT_{ROW,COL} for Explicit Column Tracker.

Reviewers: liyintang, mbautin, kranganathan, nspiegelberg

Reviewed By: kranganathan

CC: hbase-eng@lists, hbase@lists, , kranganathan, mbautin

Differential Revision: 328305

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java?rev=1181980&r1=1181979&r2=1181980&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java Tue Oct 11 17:45:26 2011
@@ -96,11 +96,12 @@ class StoreFileScanner implements KeyVal
 
   public KeyValue next() throws IOException {
     KeyValue retKey = cur;
-    cur = hfs.getKeyValue();
     try {
-      // only seek if we arent at the end. cur == null implies 'end'.
-      if (cur != null)
+      // only seek if we aren't at the end. cur == null implies 'end'.
+      if (cur != null) {
         hfs.next();
+        cur = hfs.getKeyValue();
+      }
     } catch(IOException e) {
       throw new IOException("Could not iterate " + this, e);
     }
@@ -114,7 +115,6 @@ class StoreFileScanner implements KeyVal
         return false;
       }
       cur = hfs.getKeyValue();
-      hfs.next();
       return true;
     } catch(IOException ioe) {
       throw new IOException("Could not seek " + this, ioe);
@@ -128,7 +128,6 @@ class StoreFileScanner implements KeyVal
         return false;
       }
       cur = hfs.getKeyValue();
-      hfs.next();
       return true;
     } catch (IOException ioe) {
       throw new IOException("Could not seek " + this, ioe);