incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1190644 - in /incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter: BloomFilter.java DynamicBloomFilter.java Filter.java
Date Fri, 28 Oct 2011 22:37:57 GMT
Author: kturner
Date: Fri Oct 28 22:37:56 2011
New Revision: 1190644

URL: http://svn.apache.org/viewvc?rev=1190644&view=rev
Log:
ACCUMULO-98 stopped incrementing record count when duplicate data is inserted into bloom filter

Modified:
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/BloomFilter.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/DynamicBloomFilter.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/Filter.java

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/BloomFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/BloomFilter.java?rev=1190644&r1=1190643&r2=1190644&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/BloomFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/BloomFilter.java
Fri Oct 28 22:37:56 2011
@@ -106,7 +106,7 @@ public class BloomFilter extends Filter 
   }
   
   @Override
-  public void add(Key key) {
+  public boolean add(Key key) {
     if (key == null) {
       throw new NullPointerException("key cannot be null");
     }
@@ -114,9 +114,14 @@ public class BloomFilter extends Filter 
     int[] h = hash.hash(key);
     hash.clear();
     
+    boolean bitsSet = false;
+
     for (int i = 0; i < nbHash; i++) {
+      bitsSet |= !bits.get(h[i]);
       bits.set(h[i]);
     }
+    
+    return bitsSet;
   }
   
   @Override

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/DynamicBloomFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/DynamicBloomFilter.java?rev=1190644&r1=1190643&r2=1190644&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/DynamicBloomFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/DynamicBloomFilter.java
Fri Oct 28 22:37:56 2011
@@ -124,7 +124,7 @@ public class DynamicBloomFilter extends 
   }
   
   @Override
-  public void add(Key key) {
+  public boolean add(Key key) {
     if (key == null) {
       throw new NullPointerException("Key can not be null");
     }
@@ -137,9 +137,12 @@ public class DynamicBloomFilter extends 
       currentNbRecord = 0;
     }
     
-    bf.add(key);
+    boolean added = bf.add(key);
     
-    currentNbRecord++;
+    if (added)
+      currentNbRecord++;
+    
+    return added;
   }
   
   @Override

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/Filter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/Filter.java?rev=1190644&r1=1190643&r2=1190644&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/Filter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/bloomfilter/Filter.java
Fri Oct 28 22:37:56 2011
@@ -113,8 +113,9 @@ public abstract class Filter implements 
    * 
    * @param key
    *          The key to add.
+   * @return
    */
-  public abstract void add(Key key);
+  public abstract boolean add(Key key);
   
   /**
    * Determines whether a specified key belongs to <i>this</i> filter.



Mime
View raw message