Robert Hailey wrote: > > On May 1, 2009, at 3:02 PM, Robert Hailey wrote: > > > On Aug 19, 2008, at 7:24 PM, toad at freenetproject.org > <mailto:toad at freenetproject.org> wrote: > >> Author: toad >> Date: 2008-08-20 00:24:11 +0000 (Wed, 20 Aug 2008) >> New Revision: 22046 >> >> Added: >> branches/db4o/freenet/src/freenet/support/BinaryBloomFilter.java >> branches/db4o/freenet/src/freenet/support/BloomFilter.java >> branches/db4o/freenet/src/freenet/support/CountingBloomFilter.java >> branches/db4o/freenet/src/freenet/support/NullBloomFilter.java > ... >> >> Log: >> Major optimisation: Bloom filters. >> Partially works: activelinks load, freesites don't, persistent >> requests don't work either so far. >> Will debug more. >> Version upped to 1158, but merging isn't that urgent as I skipped the >> build (1156) which introduced the Big Bug that 1158 fixes. > > [...] >> >> Property changes on: >> branches/db4o/freenet/src/freenet/support/BinaryBloomFilter.java >> ___________________________________________________________________ >> Name: svn:mergeinfo >> + >> >> Copied: branches/db4o/freenet/src/freenet/support/BloomFilter.java >> (from rev 21911, >> branches/saltedhashstore/freenet/src/freenet/support/BloomFilter.java) >> =================================================================== >> --- branches/db4o/freenet/src/freenet/support/BloomFilter.java >> (rev 0) >> +++ branches/db4o/freenet/src/freenet/support/BloomFilter.java >> 2008-08-20 00:24:11 UTC (rev 22046) >> @@ -0,0 +1,185 @@ >> +package freenet.support; >> + >> +import java.io.File; >> +import java.io.IOException; >> +import java.nio.ByteBuffer; >> +import java.nio.MappedByteBuffer; >> +import java.util.Random; >> +import java.util.concurrent.locks.ReadWriteLock; >> +import java.util.concurrent.locks.ReentrantReadWriteLock; >> + >> +import org.spaceroots.mantissa.random.MersenneTwister; >> + >> +public abstract class BloomFilter { >> + protected ByteBuffer filter; >> + > [...] >> + >> + // Wierd impl's should override >> + public void unsetAll() { >> + int x = filter.limit(); >> + for(int i=0;i<x;i++) >> + filter.put(i, (byte)0); >> + } > [...] > > I think that there is a big (but subtle) flaw here... As far as I can > tell unsetAll() is the only way to clear/initialize the filter and that > it is never called (not on new store and not on rebuildBloom()).
initial filters are always zero, don't have to unset manually. rebuilding the salt-hash store always start with a new filter. > > -- > Robert Hailey
