Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

auto-delete of corrupted word files during word-migration

orbiter02f801301372
diff --git a/source/de/anomic/plasma/plasmaWordIndexCache.java b/source/de/anomic/plasma/plasmaWordIndexCache.java
index 8da039703..268afc3f9 100644
--- a/source/de/anomic/plasma/plasmaWordIndexCache.java
+++ b/source/de/anomic/plasma/plasmaWordIndexCache.java
@@ -574,18 +574,25 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
return -container.size();
} else {
// the combined container will fit, read the container
- Iterator entries = entity.elements(true);
- plasmaWordIndexEntry entry;
- while (entries.hasNext()) {
- entry = (plasmaWordIndexEntry) entries.next();
- container.add(new plasmaWordIndexEntry[]{entry}, System.currentTimeMillis());
+ try {
+ Iterator entries = entity.elements(true);
+ plasmaWordIndexEntry entry;
+ while (entries.hasNext()) {
+ entry = (plasmaWordIndexEntry) entries.next();
+ container.add(new plasmaWordIndexEntry[]{entry}, System.currentTimeMillis());
+ }
+ // we have read all elements, now delete the entity
+ entity.deleteComplete();
+ entity.close(); entity = null;
+ // integrate the container into the assortments; this will work
+ assortmentCluster.storeTry(wordhash, container);
+ return size;
+ } catch (kelondroException e) {
+ // database corrupted, we simply give up the database and delete it
+ try {entity.close();} catch (Exception ee) {} entity = null;
+ try {db.delete();} catch (Exception ee) {}
+ return 0;
}
- // we have read all elements, now delete the entity
- entity.deleteComplete();
- entity.close(); entity = null;
- // integrate the container into the assortments; this will work
- assortmentCluster.storeTry(wordhash, container);
- return size;
}
}
} finally {
diff --git a/source/yacy.java b/source/yacy.java
index 62fe195df..c9e3cc81f 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -663,7 +663,7 @@ public final class yacy {
wordhash = wordfile.getName().substring(0, 12);
migration = wordIndexCache.migrateWords2Assortment(wordhash);
if (migration == 0)
- log.logInfo("SKIPPED " + wordhash + ": too big");
+ log.logInfo("SKIPPED " + wordhash + ": " + ((wordfile.exists()) ? "too big" : "database corrupted; deleted"));
else if (migration > 0)
log.logInfo("MIGRATED " + wordhash + ": " + migration + " entries");
else