From 6d2f15971a8f59aff291ca45717da33a9ba15e35 Mon Sep 17 00:00:00 2001 From: orbiter Date: Sat, 12 Aug 2006 13:45:23 +0000 Subject: [PATCH] there is a very strange error that causes that the kelondroRecords structure is corrupted. The cause is, that the deleted-records-chain has wrong entries, and one of the pointers in that chain points to a place behind the file end. This causes an IndexOutOfBoundsException within an IO operation. I currently don't know the reason that the deleted-records-chain is corrupted, but the error can be catched. If this now happens with the assortment database, the database is deleted. See also: http://www.yacy-forum.de/viewtopic.php?p=24586#24586 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2396 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/data/listManager.java | 2 -- source/de/anomic/plasma/plasmaWordIndex.java | 4 ++-- source/de/anomic/plasma/plasmaWordIndexAssortment.java | 8 ++++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/de/anomic/data/listManager.java b/source/de/anomic/data/listManager.java index 9516de6e3..1e6e4b197 100644 --- a/source/de/anomic/data/listManager.java +++ b/source/de/anomic/data/listManager.java @@ -193,8 +193,6 @@ public class listManager { // get a Directory Listing as a String Array public static String[] getDirListing(String dirname){ - String[] fileListString; - File[] fileList; final File dir = new File(dirname); return getDirListing(dir); } diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java index 0c14160b1..5fa7dc7aa 100644 --- a/source/de/anomic/plasma/plasmaWordIndex.java +++ b/source/de/anomic/plasma/plasmaWordIndex.java @@ -201,8 +201,8 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI { public void flushCacheSome() { synchronized (ramCache) { ramCache.shiftK2W(); } - int flushCount = ramCache.wSize() / 350; - if (flushCount > 80) flushCount = 80; + int flushCount = ramCache.wSize() / 400; + if (flushCount > 200) flushCount = 200; if (flushCount < 20) flushCount = Math.min(20, ramCache.wSize()); flushCache(flushCount); } diff --git a/source/de/anomic/plasma/plasmaWordIndexAssortment.java b/source/de/anomic/plasma/plasmaWordIndexAssortment.java index 031f4d60f..72fc88e41 100644 --- a/source/de/anomic/plasma/plasmaWordIndexAssortment.java +++ b/source/de/anomic/plasma/plasmaWordIndexAssortment.java @@ -133,6 +133,8 @@ public final class plasmaWordIndexAssortment { return; } catch (IOException e){ serverLog.logSevere("PLASMA", "unable to open assortment database " + assortmentLength + ", creating new: " + e.getMessage(), e); + } catch (IndexOutOfBoundsException e){ + serverLog.logSevere("PLASMA", "assortment database " + assortmentLength + " corupted, creating new: " + e.getMessage(), e); } catch (kelondroException e) { serverLog.logSevere("PLASMA", "assortment database " + assortmentLength + " corupted, creating new: " + e.getMessage(), e); } @@ -163,9 +165,15 @@ public final class plasmaWordIndexAssortment { try { oldrow = assortments.put(row); } catch (IOException e) { + e.printStackTrace(); + log.logSevere("storeAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB " + assortments.file(), e); + resetDatabase(); + } catch (IndexOutOfBoundsException e) { + e.printStackTrace(); log.logSevere("storeAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB " + assortments.file(), e); resetDatabase(); } catch (kelondroException e) { + e.printStackTrace(); log.logSevere("storeAssortment/kelondro-error: " + e.getMessage() + " - reset assortment-DB " + assortments.file(), e); resetDatabase(); }