You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2015/05/20 01:13:59 UTC

[04/50] [abbrv] hbase git commit: HBASE-13630 - Remove dead code in BufferedDataEncoder (Ram)

HBASE-13630 - Remove dead code in BufferedDataEncoder (Ram)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/52f635df
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/52f635df
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/52f635df

Branch: refs/heads/hbase-11339
Commit: 52f635df0061a89f94b010e7cded7796816d7742
Parents: 11b7673
Author: ramkrishna <ra...@gmail.com>
Authored: Fri May 8 09:15:46 2015 +0530
Committer: ramkrishna <ra...@gmail.com>
Committed: Fri May 8 09:15:46 2015 +0530

----------------------------------------------------------------------
 .../io/encoding/BufferedDataBlockEncoder.java   | 97 +++++++++-----------
 1 file changed, 44 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/52f635df/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
index 490d160..55fd811 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
@@ -700,68 +700,59 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
       KeyValue.KeyOnlyKeyValue currentCell = new KeyValue.KeyOnlyKeyValue();
       do {
         int comp;
-        if (comparator != null) {
-          currentCell.setKey(current.keyBuffer, 0, current.keyLength);
-          if (current.lastCommonPrefix != 0) {
-            // The KV format has row key length also in the byte array. The
-            // common prefix
-            // includes it. So we need to subtract to find out the common prefix
-            // in the
-            // row part alone
-            rowCommonPrefix = Math.min(rowCommonPrefix, current.lastCommonPrefix - 2);
-          }
-          if (current.lastCommonPrefix <= 2) {
-            rowCommonPrefix = 0;
-          }
-          rowCommonPrefix += findCommonPrefixInRowPart(seekCell, currentCell,
-              rowCommonPrefix);
-          comp = compareCommonRowPrefix(seekCell, currentCell,
-              rowCommonPrefix);
+        currentCell.setKey(current.keyBuffer, 0, current.keyLength);
+        if (current.lastCommonPrefix != 0) {
+          // The KV format has row key length also in the byte array. The
+          // common prefix
+          // includes it. So we need to subtract to find out the common prefix
+          // in the
+          // row part alone
+          rowCommonPrefix = Math.min(rowCommonPrefix, current.lastCommonPrefix - 2);
+        }
+        if (current.lastCommonPrefix <= 2) {
+          rowCommonPrefix = 0;
+        }
+        rowCommonPrefix += findCommonPrefixInRowPart(seekCell, currentCell, rowCommonPrefix);
+        comp = compareCommonRowPrefix(seekCell, currentCell, rowCommonPrefix);
+        if (comp == 0) {
+          comp = compareTypeBytes(seekCell, currentCell);
           if (comp == 0) {
-            comp = compareTypeBytes(seekCell, currentCell);
+            // Subtract the fixed row key length and the family key fixed length
+            familyCommonPrefix = Math.max(
+                0,
+                Math.min(familyCommonPrefix,
+                    current.lastCommonPrefix - (3 + currentCell.getRowLength())));
+            familyCommonPrefix += findCommonPrefixInFamilyPart(seekCell, currentCell,
+                familyCommonPrefix);
+            comp = compareCommonFamilyPrefix(seekCell, currentCell, familyCommonPrefix);
             if (comp == 0) {
-              // Subtract the fixed row key length and the family key fixed length
-              familyCommonPrefix = Math.max(
+              // subtract the rowkey fixed length and the family key fixed
+              // length
+              qualCommonPrefix = Math.max(
                   0,
-                  Math.min(familyCommonPrefix,
-                      current.lastCommonPrefix - (3 + currentCell.getRowLength())));
-              familyCommonPrefix += findCommonPrefixInFamilyPart(seekCell,
-                  currentCell, familyCommonPrefix);
-              comp = compareCommonFamilyPrefix(seekCell, currentCell,
-                  familyCommonPrefix);
+                  Math.min(
+                      qualCommonPrefix,
+                      current.lastCommonPrefix
+                          - (3 + currentCell.getRowLength() + currentCell.getFamilyLength())));
+              qualCommonPrefix += findCommonPrefixInQualifierPart(seekCell, currentCell,
+                  qualCommonPrefix);
+              comp = compareCommonQualifierPrefix(seekCell, currentCell, qualCommonPrefix);
               if (comp == 0) {
-                // subtract the rowkey fixed length and the family key fixed
-                // length
-                qualCommonPrefix = Math.max(
-                    0,
-                    Math.min(
-                        qualCommonPrefix,
-                        current.lastCommonPrefix
-                            - (3 + currentCell.getRowLength() + currentCell.getFamilyLength())));
-                qualCommonPrefix += findCommonPrefixInQualifierPart(seekCell,
-                    currentCell, qualCommonPrefix);
-                comp = compareCommonQualifierPrefix(seekCell, currentCell,
-                    qualCommonPrefix);
+                comp = CellComparator.compareTimestamps(seekCell, currentCell);
                 if (comp == 0) {
-                  comp = CellComparator.compareTimestamps(seekCell, currentCell);
-                  if (comp == 0) {
-                    // Compare types. Let the delete types sort ahead of puts;
-                    // i.e. types
-                    // of higher numbers sort before those of lesser numbers.
-                    // Maximum
-                    // (255)
-                    // appears ahead of everything, and minimum (0) appears
-                    // after
-                    // everything.
-                    comp = (0xff & currentCell.getTypeByte()) - (0xff & seekCell.getTypeByte());
-                  }
+                  // Compare types. Let the delete types sort ahead of puts;
+                  // i.e. types
+                  // of higher numbers sort before those of lesser numbers.
+                  // Maximum
+                  // (255)
+                  // appears ahead of everything, and minimum (0) appears
+                  // after
+                  // everything.
+                  comp = (0xff & currentCell.getTypeByte()) - (0xff & seekCell.getTypeByte());
                 }
               }
             }
           }
-        } else {
-          Cell r = new KeyValue.KeyOnlyKeyValue(current.keyBuffer, 0, current.keyLength);
-          comp = comparator.compareKeyIgnoresMvcc(seekCell, r);
         }
         if (comp == 0) { // exact match
           if (seekBefore) {