Author: j16sdiz
Date: 2008-07-10 11:54:58 +0000 (Thu, 10 Jul 2008)
New Revision: 21022

Modified:
   
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
Log:
smoother bloom filter size change

Modified: 
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
===================================================================
--- 
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
   2008-07-10 11:54:35 UTC (rev 21021)
+++ 
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
   2008-07-10 11:54:58 UTC (rev 21022)
@@ -55,7 +55,7 @@

        private static final int BLOOM_FILTER_SIZE = 0x10000000; // 128Mib = 
16MiB
        private static final boolean updateBloom = true;
-       private static final boolean checkBloom = true;
+       private static boolean checkBloom = true;
        private int bloomFilterK;
        private BloomFilter bloomFilter;

@@ -110,8 +110,10 @@

                if (updateBloom || checkBloom) {
                        File bloomFile = new File(this.baseDir, name + 
".bloom");
-                       if (!bloomFile.exists() || bloomFile.length() != 
BLOOM_FILTER_SIZE / 8)
+                       if (!bloomFile.exists() || bloomFile.length() != 
BLOOM_FILTER_SIZE / 8) {
                                flags |= FLAG_REBUILD_BLOOM;
+                               checkBloom = false;
+                       }
                        bloomFilter = new BloomFilter(bloomFile, 
BLOOM_FILTER_SIZE, bloomFilterK);
                }

@@ -1021,6 +1023,7 @@
                                prevStoreSize = 0;

                                flags &= ~FLAG_REBUILD_BLOOM;
+                               checkBloom = true;
                                bloomFilterK = optimialK;
                        } finally {
                                configLock.writeLock().unlock();
@@ -1080,6 +1083,7 @@
                        configLock.writeLock().lock();
                        try {
                                flags &= ~FLAG_REBUILD_BLOOM;
+                               checkBloom = true;
                                bloomFilterK = optimialK;
                        } finally {
                                configLock.writeLock().unlock();


Reply via email to