hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: HADOOP-11327. BloomFilter#not() omits the last bit, resulting in an incorrect filter. Contributed by Eric Payne (cherry picked from commit 07b08060369caf34f248745a10bda61fb0a3ef23)
Date Wed, 21 Jan 2015 19:08:08 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 683cc18bb -> 57a53acad


HADOOP-11327. BloomFilter#not() omits the last bit, resulting in an incorrect filter. Contributed
by Eric Payne
(cherry picked from commit 07b08060369caf34f248745a10bda61fb0a3ef23)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/57a53aca
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/57a53aca
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/57a53aca

Branch: refs/heads/branch-2
Commit: 57a53acad4c7991efbc63ee8c2bc227dd0873c54
Parents: 683cc18
Author: Jason Lowe <jlowe@apache.org>
Authored: Wed Jan 21 19:04:29 2015 +0000
Committer: Jason Lowe <jlowe@apache.org>
Committed: Wed Jan 21 19:07:26 2015 +0000

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt          |  3 +++
 .../java/org/apache/hadoop/util/bloom/BloomFilter.java   |  2 +-
 .../org/apache/hadoop/util/bloom/TestBloomFilters.java   | 11 +++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/57a53aca/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 7320642..91e31e3 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -375,6 +375,9 @@ Release 2.7.0 - UNRELEASED
     HADOOP-10668. TestZKFailoverControllerStress#testExpireBackAndForth
     occasionally fails. (Ming Ma via cnauroth)
 
+    HADOOP-11327. BloomFilter#not() omits the last bit, resulting in an
+    incorrect filter (Eric Payne via jlowe)
+
 Release 2.6.0 - 2014-11-18
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/57a53aca/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
index e2dea6d..f8b9519 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
@@ -157,7 +157,7 @@ public class BloomFilter extends Filter {
 
   @Override
   public void not() {
-    bits.flip(0, vectorSize - 1);
+    bits.flip(0, vectorSize);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hadoop/blob/57a53aca/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
index 93fa6d5..6ff854d 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.AbstractCollection;
+import java.util.BitSet;
 import java.util.Iterator;
 
 import org.apache.hadoop.util.bloom.BloomFilterCommonTester.BloomFilterTestStrategy;
@@ -237,4 +238,14 @@ public class TestBloomFilters {
                 BloomFilterTestStrategy.FILTER_AND_STRATEGY,
                 BloomFilterTestStrategy.FILTER_XOR_STRATEGY)).test();
   }
+
+  @Test
+  public void testNot() {
+    BloomFilter bf = new BloomFilter(8, 1, Hash.JENKINS_HASH);
+    bf.bits = BitSet.valueOf(new byte[] { (byte) 0x95 });
+    BitSet origBitSet = (BitSet) bf.bits.clone();
+    bf.not();
+    assertFalse("BloomFilter#not should have inverted all bits",
+                bf.bits.intersects(origBitSet));
+  }
 }


Mime
View raw message