From 0bb4fbc403645820517a93ac7ffed8db9d7bde81 Mon Sep 17 00:00:00 2001 From: lotus Date: Wed, 10 Sep 2008 12:55:14 +0000 Subject: [PATCH] delete corrupted collecion.index on exit for rebuild on next start see http://forum.yacy-websuche.de/viewtopic.php?p=9725#p9725 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5135 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/index/indexCollectionRI.java | 4 ++++ source/de/anomic/kelondro/kelondroCollectionIndex.java | 5 +++++ source/de/anomic/plasma/plasmaDHTChunk.java | 1 + source/de/anomic/plasma/plasmaWordIndex.java | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/source/de/anomic/index/indexCollectionRI.java b/source/de/anomic/index/indexCollectionRI.java index 13468a686..3ed94a5b7 100644 --- a/source/de/anomic/index/indexCollectionRI.java +++ b/source/de/anomic/index/indexCollectionRI.java @@ -67,6 +67,10 @@ public class indexCollectionRI implements indexRI { } } + public void deleteIndexOnExit() { + collectionIndex.deleteIndexOnExit(); + } + public long getUpdateTime(final String wordHash) { final indexContainer entries = getContainer(wordHash, null); if (entries == null) return 0; diff --git a/source/de/anomic/kelondro/kelondroCollectionIndex.java b/source/de/anomic/kelondro/kelondroCollectionIndex.java index 2b45a05e0..d20397514 100644 --- a/source/de/anomic/kelondro/kelondroCollectionIndex.java +++ b/source/de/anomic/kelondro/kelondroCollectionIndex.java @@ -177,6 +177,11 @@ public class kelondroCollectionIndex { } } + public void deleteIndexOnExit() { + // will be rebuilt on next start + new File(this.path, this.filenameStub + ".index").deleteOnExit(); + } + private void openAllArrayFiles(final boolean indexGeneration, final kelondroByteOrder indexOrder) throws IOException { final String[] list = this.path.list(); diff --git a/source/de/anomic/plasma/plasmaDHTChunk.java b/source/de/anomic/plasma/plasmaDHTChunk.java index 89411d6ff..96559eee1 100644 --- a/source/de/anomic/plasma/plasmaDHTChunk.java +++ b/source/de/anomic/plasma/plasmaDHTChunk.java @@ -270,6 +270,7 @@ public class plasmaDHTChunk { indexContainers = new indexContainer[0]; urlCache = new HashMap(); this.status = chunkStatus_FAILED; + wordIndex.deleteIndexOnExit(); // delete index on exit for rebuild return 0; } } diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java index 22df773bf..a5614c488 100644 --- a/source/de/anomic/plasma/plasmaWordIndex.java +++ b/source/de/anomic/plasma/plasmaWordIndex.java @@ -219,6 +219,10 @@ public final class plasmaWordIndex implements indexRI { queuePreStack.clear(); } + public void deleteIndexOnExit() { + collections.deleteIndexOnExit(); + } + private void initActiveCrawlProfiles() { this.defaultProxyProfile = null; this.defaultRemoteProfile = null;