Author: j16sdiz
Date: 2008-06-30 14:06:18 +0000 (Mon, 30 Jun 2008)
New Revision: 20873

Modified:
   
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java
Log:
force bloom filter in cleaner thread


Modified: 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java
===================================================================
--- 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java  
    2008-06-30 14:05:55 UTC (rev 20872)
+++ 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java  
    2008-06-30 14:06:18 UTC (rev 20873)
@@ -57,7 +57,6 @@
        private static final byte FLAG_DIRTY = 0x1;
        private static final byte FLAG_REBUILD_BLOOM = 0x2;

-       private static final long BLOOM_SYNC_INTERVAL = 256;
        private static final int BLOOM_FILTER_SIZE = 0x8000000; // bits
        private static final int BLOOM_FILTER_K = 5;
        private static final boolean updateBloom = true;
@@ -272,8 +271,6 @@
                                                long written = 
writes.incrementAndGet();
                                                keyCount.incrementAndGet();

-                                               if (updateBloom && written % 
BLOOM_SYNC_INTERVAL == 0)
-                                                       bloomFilter.force();
                                                return;
                                        }
                                }
@@ -285,8 +282,6 @@
                                        
bloomFilter.updateFilter(getDigestedRoutingKey(routingKey));
                                writeEntry(entry, offset[0]);
                                long written = writes.incrementAndGet();
-                               if (updateBloom && written % 
BLOOM_SYNC_INTERVAL == 0)
-                                       bloomFilter.force();
                        } finally {
                                unlockPlainKey(routingKey, false);
                        }
@@ -898,6 +893,12 @@
                                        }

                                        try {
+                                               if (bloomFilter != null)
+                                                       bloomFilter.force();
+                                       } catch (Exception e) { // may throw 
IOException (even if it is not defined)
+                                               Logger.error(this, "Can't force 
bloom filter", e);
+                                       }
+                                       try {
                                                writeConfigFile();
                                        } catch (IOException e) {
                                                Logger.error(this, "Can't write 
config file", e);


Reply via email to