Author: j16sdiz
Date: 2008-04-09 06:40:17 +0000 (Wed, 09 Apr 2008)
New Revision: 19107
Modified:
trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
Factor out BerkeleyDBFreenetStore.removeSecondaryDatabase()
Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-04-09
06:39:59 UTC (rev 19106)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-04-09
06:40:17 UTC (rev 19107)
@@ -296,31 +296,7 @@
this.fixSecondaryFile = fixSecondaryFile;
if(fixSecondaryFile.exists()) {
fixSecondaryFile.delete();
- Logger.error(this, "Recreating secondary databases");
- Logger.error(this, "This may take some time...");
- System.err.println("Recreating secondary databases");
- System.err.println("This may take some time...");
-
WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE,
5*60*1000+keysDB.count()*100)));
- // Of course it's not a solution but a quick fix
- // Integer.MAX_VALUE seems to trigger an overflow or
whatever ...
- // Either we find out what the maximum value is and we
do a static method somewhere ensuring
- // it won't overflow ... or we debug the wrapper.
- // NB: it might be a wrapper-version-mismatch problem
(nextgens)
- try {
- try {
- environment.removeDatabase(null,
prefix+"CHK_accessTime");
- } catch (DatabaseNotFoundException e) {
- // Cool!
- }
- try {
- environment.removeDatabase(null,
prefix+"CHK_blockNum");
- } catch (DatabaseNotFoundException e) {
- // Cool!
- }
- } catch (DatabaseException e) {
- close(false);
- throw e;
- }
+ removeSecondaryDatabase();
}
// Initialize secondary CHK database sorted on accesstime
@@ -2051,4 +2027,32 @@
public long keyCount() {
return blocksInStore;
}
+
+ private void removeSecondaryDatabase() throws DatabaseException {
+ Logger.error(this, "Recreating secondary databases");
+ Logger.error(this, "This may take some time...");
+ System.err.println("Recreating secondary databases");
+ System.err.println("This may take some time...");
+ WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE,
5*60*1000+keysDB.count()*100)));
+ // Of course it's not a solution but a quick fix
+ // Integer.MAX_VALUE seems to trigger an overflow or whatever
...
+ // Either we find out what the maximum value is and we do a
static method somewhere ensuring
+ // it won't overflow ... or we debug the wrapper.
+ // NB: it might be a wrapper-version-mismatch problem (nextgens)
+ try {
+ try {
+ environment.removeDatabase(null,
name+"CHK_accessTime");
+ } catch (DatabaseNotFoundException e) {
+ // Cool!
+ }
+ try {
+ environment.removeDatabase(null,
name+"CHK_blockNum");
+ } catch (DatabaseNotFoundException e) {
+ // Cool!
+ }
+ } catch (DatabaseException e) {
+ close(false);
+ throw e;
+ }
+ }
}