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
This commit is contained in:
lotus 2008-09-10 12:55:14 +00:00
parent b68d06a6e8
commit 0bb4fbc403
4 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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;