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 0036E10175 for ; Wed, 9 Oct 2013 18:18:50 +0000 (UTC) Received: (qmail 21918 invoked by uid 500); 9 Oct 2013 18:18:42 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 21775 invoked by uid 500); 9 Oct 2013 18:18:42 -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 21753 invoked by uid 99); 9 Oct 2013 18:18:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 18:18:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 18:18:40 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1BC5823889FA; Wed, 9 Oct 2013 18:18:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1530746 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheKey.java test/java/org/apache/hadoop/hbase/io/hfile/TestBlockCacheKeyWithEncoding.java Date: Wed, 09 Oct 2013 18:18:20 -0000 To: commits@hbase.apache.org From: liyin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131009181820.1BC5823889FA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: liyin Date: Wed Oct 9 18:18:19 2013 New Revision: 1530746 URL: http://svn.apache.org/r1530746 Log: [HBASE-9102] Modifies the equals to BlockCacheKey and removes the TestBlockCacheKeyWithEncoding test Author: rshroff Summary: We should add the encoding check to the equals() also. Also removed the test which was added by the culprit diff Test Plan: mr Reviewers: gauravm, adela, manukranthk Reviewed By: gauravm CC: hbase-eng@ Differential Revision: https://phabricator.fb.com/D1001806 Task ID: 2973454 Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheKey.java hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/hfile/TestBlockCacheKeyWithEncoding.java Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheKey.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheKey.java?rev=1530746&r1=1530745&r2=1530746&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheKey.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheKey.java Wed Oct 9 18:18:19 2013 @@ -62,7 +62,9 @@ public class BlockCacheKey implements He BlockCacheKey k = (BlockCacheKey) o; return offset == k.offset && (hfileName == null ? k.hfileName == null : hfileName - .equals(k.hfileName)); + .equals(k.hfileName)) + && (encoding == null ? k.encoding == null : + encoding.ordinal() == k.encoding.ordinal()); } else { return false; } Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/hfile/TestBlockCacheKeyWithEncoding.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/hfile/TestBlockCacheKeyWithEncoding.java?rev=1530746&r1=1530745&r2=1530746&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/hfile/TestBlockCacheKeyWithEncoding.java (original) +++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/hfile/TestBlockCacheKeyWithEncoding.java Wed Oct 9 18:18:19 2013 @@ -1,23 +0,0 @@ -package org.apache.hadoop.hbase.io.hfile; - -import static org.junit.Assert.assertEquals; - -import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding; -import org.junit.Test; - -public class TestBlockCacheKeyWithEncoding { - - @Test - public void testBlockCachedWithNullTypeFoundWithEncoding() { - // Assume we read and cache an index block with "null" passed to readBlock - BlockCacheKey key1 = - new BlockCacheKey("t35tf1l3n4m3", 55555, DataBlockEncoding.PREFIX, null); - // The next time we request the same block as an index block we should find it in the block - // cache - BlockCacheKey key2 = - new BlockCacheKey("t35tf1l3n4m3", 55555, DataBlockEncoding.PREFIX, - BlockType.LEAF_INDEX); - assertEquals("missmatch in hashCode", key1.hashCode(), key2.hashCode()); - assertEquals("missmatch in object.equals", key1.hashCode(), key2.hashCode()); - } -}