You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2011/01/27 09:54:20 UTC

svn commit: r1064034 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java

Author: larsgeorge
Date: Thu Jan 27 08:54:20 2011
New Revision: 1064034

URL: http://svn.apache.org/viewvc?rev=1064034&view=rev
Log:
HBASE-3476 HFile -m option need not scan key values (Prakash Khemani via Lars George)

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1064034&r1=1064033&r2=1064034&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Jan 27 08:54:20 2011
@@ -28,6 +28,8 @@ Release 0.91.0 - Unreleased
    HBASE-3387  Pair does not deep check arrays for equality -- REVERT THIS PATCH
    HBASE-3449  Server shutdown handlers deadlocked waiting for META
    HBASE-3456  Fix hardcoding of 20 second socket timeout down in HBaseClient
+   HBASE-3476  HFile -m option need not scan key values
+               (Prakash Khemani via Lars George)
 
 
   IMPROVEMENTS

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java?rev=1064034&r1=1064033&r2=1064034&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java Thu Jan 27 08:54:20 2011
@@ -1951,45 +1951,47 @@ public class HFile {
         // create reader and load file info
         HFile.Reader reader = new HFile.Reader(fs, file, null, false, false);
         Map<byte[],byte[]> fileInfo = reader.loadFileInfo();
-        // scan over file and read key/value's and check if requested
-        HFileScanner scanner = reader.getScanner(false, false);
-        scanner.seekTo();
-        KeyValue pkv = null;
         int count = 0;
-        do {
-          KeyValue kv = scanner.getKeyValue();
-          // dump key value
-          if (printKeyValue) {
-            System.out.println("K: " + kv +
-              " V: " + Bytes.toStringBinary(kv.getValue()));
-          }
-          // check if rows are in order
-          if (checkRow && pkv != null) {
-            if (Bytes.compareTo(pkv.getRow(), kv.getRow()) > 0) {
-              System.err.println("WARNING, previous row is greater then" +
-                " current row\n\tfilename -> " + file +
-                "\n\tprevious -> " + Bytes.toStringBinary(pkv.getKey()) +
-                "\n\tcurrent  -> " + Bytes.toStringBinary(kv.getKey()));
+        if (verbose || printKeyValue || checkRow || checkFamily) {
+          // scan over file and read key/value's and check if requested
+          HFileScanner scanner = reader.getScanner(false, false);
+          scanner.seekTo();
+          KeyValue pkv = null;
+          do {
+            KeyValue kv = scanner.getKeyValue();
+            // dump key value
+            if (printKeyValue) {
+              System.out.println("K: " + kv +
+                  " V: " + Bytes.toStringBinary(kv.getValue()));
             }
-          }
-          // check if families are consistent
-          if (checkFamily) {
-            String fam = Bytes.toString(kv.getFamily());
-            if (!file.toString().contains(fam)) {
-              System.err.println("WARNING, filename does not match kv family," +
-                "\n\tfilename -> " + file +
-                "\n\tkeyvalue -> " + Bytes.toStringBinary(kv.getKey()));
+            // check if rows are in order
+            if (checkRow && pkv != null) {
+              if (Bytes.compareTo(pkv.getRow(), kv.getRow()) > 0) {
+                System.err.println("WARNING, previous row is greater then" +
+                    " current row\n\tfilename -> " + file +
+                    "\n\tprevious -> " + Bytes.toStringBinary(pkv.getKey()) +
+                    "\n\tcurrent  -> " + Bytes.toStringBinary(kv.getKey()));
+              }
             }
-            if (pkv != null && Bytes.compareTo(pkv.getFamily(), kv.getFamily()) != 0) {
-              System.err.println("WARNING, previous kv has different family" +
-                " compared to current key\n\tfilename -> " + file +
-                "\n\tprevious -> " +  Bytes.toStringBinary(pkv.getKey()) +
-                "\n\tcurrent  -> " + Bytes.toStringBinary(kv.getKey()));
+            // check if families are consistent
+            if (checkFamily) {
+              String fam = Bytes.toString(kv.getFamily());
+              if (!file.toString().contains(fam)) {
+                System.err.println("WARNING, filename does not match kv family," +
+                    "\n\tfilename -> " + file +
+                    "\n\tkeyvalue -> " + Bytes.toStringBinary(kv.getKey()));
+              }
+              if (pkv != null && Bytes.compareTo(pkv.getFamily(), kv.getFamily()) != 0) {
+                System.err.println("WARNING, previous kv has different family" +
+                    " compared to current key\n\tfilename -> " + file +
+                    "\n\tprevious -> " +  Bytes.toStringBinary(pkv.getKey()) +
+                    "\n\tcurrent  -> " + Bytes.toStringBinary(kv.getKey()));
+              }
             }
-          }
-          pkv = kv;
-          count++;
-        } while (scanner.next());
+            pkv = kv;
+            count++;
+          } while (scanner.next());
+        }
         if (verbose || printKeyValue) {
           System.out.println("Scanned kv count -> " + count);
         }