Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D34B017E5F for ; Wed, 20 May 2015 15:25:14 +0000 (UTC) Received: (qmail 2284 invoked by uid 500); 20 May 2015 15:25:14 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 2186 invoked by uid 500); 20 May 2015 15:25:14 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 2025 invoked by uid 99); 20 May 2015 15:25:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 May 2015 15:25:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6BAA9DFAFF; Wed, 20 May 2015 15:25:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jmhsieh@apache.org To: commits@hbase.apache.org Date: Wed, 20 May 2015 15:25:17 -0000 Message-Id: <65623c5923454acd883b98b1b2b30e4f@git.apache.org> In-Reply-To: <0fe4822c7b4844099ae46ed01fe78d01@git.apache.org> References: <0fe4822c7b4844099ae46ed01fe78d01@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Fri May 8 09:15:46 2015 +0530 Committer: ramkrishna 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) {