hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
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 GMT
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());
-  }
-}



Mime
View raw message