Author: toad
Date: 2006-04-13 15:28:24 +0000 (Thu, 13 Apr 2006)
New Revision: 8536

Modified:
   trunk/freenet/src/freenet/node/Version.java
   trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
641:
If a file called "recreate_secondary_db" exists in the store dir, then wipe the 
secondary database (the atimes db) and reconstruct it.
Do this if you get an error like this:
com.sleepycat.je.DatabaseException: Secondary CHK_accessTime is corrupt: it 
refers to a missing key in the primary database
(This isn't done automatically as a) it requires a restart and b) it can't be 
reliably detected as BDB uses a generic exception so we'd have to go by the 
description, which is hit-and-miss with future versions)

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-04-13 13:38:33 UTC (rev 
8535)
+++ trunk/freenet/src/freenet/node/Version.java 2006-04-13 15:28:24 UTC (rev 
8536)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 640;
+       private static final int buildNumber = 641;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 591;

Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2006-04-13 
13:38:33 UTC (rev 8535)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2006-04-13 
15:28:24 UTC (rev 8536)
@@ -102,12 +102,19 @@
                dbConfig.setAllowCreate(true);
                dbConfig.setTransactional(true);
                chkDB = environment.openDatabase(null,"CHK",dbConfig);
-                               
+               
+               File fixSecondary = new File(storeDir, "recreate_secondary_db");
+               if(fixSecondary.exists()) {
+                       fixSecondary.delete();
+                       environment.truncateDatabase(null, "CHK_accessTime", 
false);
+               }
+               
                // Initialize secondary CHK database sorted on accesstime
                SecondaryConfig secDbConfig = new SecondaryConfig();
                secDbConfig.setAllowCreate(true);
                secDbConfig.setSortedDuplicates(true);
                secDbConfig.setTransactional(true);
+               secDbConfig.setAllowPopulate(true);
                storeBlockTupleBinding = new StoreBlockTupleBinding();
                longTupleBinding = TupleBinding.getPrimitiveBinding(Long.class);
                AccessTimeKeyCreator accessTimeKeyCreator = 


Reply via email to