HADOOP-11327. BloomFilter#not() omits the last bit, resulting in an incorrect filter. Contributed by Eric Payne
(cherry picked from commit 07b0806036
)
This commit is contained in:
parent
683cc18bba
commit
57a53acad4
|
@ -375,6 +375,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
HADOOP-10668. TestZKFailoverControllerStress#testExpireBackAndForth
|
HADOOP-10668. TestZKFailoverControllerStress#testExpireBackAndForth
|
||||||
occasionally fails. (Ming Ma via cnauroth)
|
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
|
Release 2.6.0 - 2014-11-18
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class BloomFilter extends Filter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void not() {
|
public void not() {
|
||||||
bits.flip(0, vectorSize - 1);
|
bits.flip(0, vectorSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.AbstractCollection;
|
import java.util.AbstractCollection;
|
||||||
|
import java.util.BitSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.hadoop.util.bloom.BloomFilterCommonTester.BloomFilterTestStrategy;
|
import org.apache.hadoop.util.bloom.BloomFilterCommonTester.BloomFilterTestStrategy;
|
||||||
|
@ -237,4 +238,14 @@ public class TestBloomFilters {
|
||||||
BloomFilterTestStrategy.FILTER_AND_STRATEGY,
|
BloomFilterTestStrategy.FILTER_AND_STRATEGY,
|
||||||
BloomFilterTestStrategy.FILTER_XOR_STRATEGY)).test();
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue