auto-delete of corrupted word files during word-migration

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1047 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent d2731418bf
commit 02f8013013

@ -574,18 +574,25 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
return -container.size(); return -container.size();
} else { } else {
// the combined container will fit, read the container // the combined container will fit, read the container
Iterator entries = entity.elements(true); try {
plasmaWordIndexEntry entry; Iterator entries = entity.elements(true);
while (entries.hasNext()) { plasmaWordIndexEntry entry;
entry = (plasmaWordIndexEntry) entries.next(); while (entries.hasNext()) {
container.add(new plasmaWordIndexEntry[]{entry}, System.currentTimeMillis()); 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 { } finally {

@ -663,7 +663,7 @@ public final class yacy {
wordhash = wordfile.getName().substring(0, 12); wordhash = wordfile.getName().substring(0, 12);
migration = wordIndexCache.migrateWords2Assortment(wordhash); migration = wordIndexCache.migrateWords2Assortment(wordhash);
if (migration == 0) if (migration == 0)
log.logInfo("SKIPPED " + wordhash + ": too big"); log.logInfo("SKIPPED " + wordhash + ": " + ((wordfile.exists()) ? "too big" : "database corrupted; deleted"));
else if (migration > 0) else if (migration > 0)
log.logInfo("MIGRATED " + wordhash + ": " + migration + " entries"); log.logInfo("MIGRATED " + wordhash + ": " + migration + " entries");
else else

Loading…
Cancel
Save