You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2010/07/20 01:34:03 UTC
svn commit: r965678 - in /hbase/trunk: CHANGES.txt
src/test/java/org/apache/hadoop/hbase/util/TestByteBloomFilter.java
Author: stack
Date: Mon Jul 19 23:34:03 2010
New Revision: 965678
URL: http://svn.apache.org/viewvc?rev=965678&view=rev
Log:
HBASE-2851 Remove testDynamicBloom() unit test
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestByteBloomFilter.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=965678&r1=965677&r2=965678&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Mon Jul 19 23:34:03 2010
@@ -442,6 +442,8 @@ Release 0.21.0 - Unreleased
HBASE-2846 Make rest server be same as thrift and avro servers
HBASE-1511 Pseudo distributed mode in LocalHBaseCluster
(Nicolas Spiegelberg via Stack)
+ HBASE-2851 Remove testDynamicBloom() unit test
+ (Nicolas Spiegelberg via Stack)
IMPROVEMENTS
Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestByteBloomFilter.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestByteBloomFilter.java?rev=965678&r1=965677&r2=965678&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestByteBloomFilter.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestByteBloomFilter.java Mon Jul 19 23:34:03 2010
@@ -138,47 +138,4 @@ public class TestByteBloomFilter extends
// test: foldFactor > log(max/actual)
}
-
- public void testDynamicBloom() throws Exception {
- int keyInterval = 1000;
- float err = (float)0.01;
- BitSet valid = new BitSet(keyInterval*4);
-
- DynamicByteBloomFilter bf1 = new DynamicByteBloomFilter(keyInterval, err,
- Hash.MURMUR_HASH);
- bf1.allocBloom();
-
- for (int i = 0; i < keyInterval*4; ++i) { // add
- if (Math.random() > 0.5) {
- bf1.add(Bytes.toBytes(i));
- valid.set(i);
- }
- }
- assertTrue(2 <= bf1.bloomCount() && bf1.bloomCount() <= 3);
-
- // test serialization/deserialization
- ByteArrayOutputStream metaOut = new ByteArrayOutputStream();
- ByteArrayOutputStream dataOut = new ByteArrayOutputStream();
- bf1.getMetaWriter().write(new DataOutputStream(metaOut));
- bf1.getDataWriter().write(new DataOutputStream(dataOut));
- ByteBuffer bb = ByteBuffer.wrap(dataOut.toByteArray());
- DynamicByteBloomFilter newBf1 = new DynamicByteBloomFilter(
- ByteBuffer.wrap(metaOut.toByteArray()));
-
- int falsePositives = 0;
- for (int i = 0; i < keyInterval*4; ++i) { // check
- if (newBf1.contains(Bytes.toBytes(i), bb)) {
- if (!valid.get(i)) ++falsePositives;
- } else {
- if (valid.get(i)) {
- assert false;
- }
- }
- }
-
- // note that actualErr = err * bloomCount
- // error rate should be roughly: (keyInterval*2)*(err*2), allow some tolerance
- System.out.println("False positives: " + falsePositives);
- assertTrue(falsePositives <= (keyInterval*5)*err);
- }
-}
\ No newline at end of file
+}