Skip to content

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

delete corrupted collecion.index on exit for rebuild on next start see http://forum.yacy-websuche.de/viewtopic.php?p=9725#p9725

lotus0bb4fbc40364
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<String, indexURLReference>();
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;