Author: toad
Date: 2008-05-16 17:27:00 +0000 (Fri, 16 May 2008)
New Revision: 19957

Modified:
   trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
Fix an instant timeout during reconstruction on a big store.

Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-05-16 
17:16:10 UTC (rev 19956)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-05-16 
17:27:00 UTC (rev 19957)
@@ -943,7 +943,9 @@
        private void reconstruct() throws DatabaseException, IOException {
                if(keysDB.count() != 0)
                        throw new IllegalStateException("Store must be empty 
before reconstruction!");
-               int timeout = (int) (Math.min(Integer.MAX_VALUE, 5 * 60 * 1000
+               // Timeout must be well below Integer.MAX_VALUE. It is added to 
previous timeouts in an integer value.
+               // If it's too high, we get wraparound and instant timeout.
+               int timeout = (int) (Math.min(7 * 24 * 60 * 60 * 1000, 5 * 60 * 
1000
                        + (storeRAF.length() / (dataBlockSize + 
headerBlockSize)) * 1000L));
                System.err.println("Reconstructing store index from store file: 
callback="+callback+" - allowing "+timeout+"ms");
                Logger.error(this, "Reconstructing store index from store file: 
callback="+callback);


Reply via email to