From 29a1318ef9a435726b560844cd33ec2930dc2659 Mon Sep 17 00:00:00 2001 From: orbiter Date: Fri, 13 Oct 2006 22:57:47 +0000 Subject: [PATCH] bugfixes for wrong database access that do not consider deleted entries git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2767 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/index/indexRAMCacheRI.java | 8 ++++---- source/de/anomic/kelondro/kelondroCollectionIndex.java | 6 +++--- source/de/anomic/kelondro/kelondroFixedWidthArray.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/de/anomic/index/indexRAMCacheRI.java b/source/de/anomic/index/indexRAMCacheRI.java index 19f9236fd..579bdfa36 100644 --- a/source/de/anomic/index/indexRAMCacheRI.java +++ b/source/de/anomic/index/indexRAMCacheRI.java @@ -153,15 +153,15 @@ public final class indexRAMCacheRI extends indexAbstractRI implements indexRI { long urlCount = 0, urlsPerSecond = 0; try { synchronized (cache) { - int i = dumpArray.size(); + Iterator i = dumpArray.contentRows(-1); String wordHash; //long creationTime; indexEntry wordEntry; kelondroRow.Entry row; //Runtime rt = Runtime.getRuntime(); - while (i-- > 0) { + while (i.hasNext()) { // get out one entry - row = dumpArray.get(i); + row = (kelondroRow.Entry) i.next(); if ((row == null) || (row.empty(0)) || (row.empty(3)) || (row.empty(4))) continue; wordHash = row.getColString(0, "UTF-8"); //creationTime = kelondroRecords.bytes2long(row[2]); @@ -175,7 +175,7 @@ public final class indexRAMCacheRI extends indexAbstractRI implements indexRI { if (System.currentTimeMillis() > messageTime) { System.gc(); // for better statistic urlsPerSecond = 1 + urlCount * 1000 / (1 + System.currentTimeMillis() - startTime); - log.logInfo("restoring status: " + urlCount + " urls done, " + (i / urlsPerSecond) + " seconds remaining, free mem = " + (Runtime.getRuntime().freeMemory() / 1024 / 1024) + "MB"); + log.logInfo("restoring status: " + urlCount + " urls done, " + ((dumpArray.size() - urlCount) / urlsPerSecond) + " seconds remaining, free mem = " + (Runtime.getRuntime().freeMemory() / 1024 / 1024) + "MB"); messageTime = System.currentTimeMillis() + 5000; } } diff --git a/source/de/anomic/kelondro/kelondroCollectionIndex.java b/source/de/anomic/kelondro/kelondroCollectionIndex.java index 0d49a49fd..fbeb1f7cd 100644 --- a/source/de/anomic/kelondro/kelondroCollectionIndex.java +++ b/source/de/anomic/kelondro/kelondroCollectionIndex.java @@ -143,7 +143,7 @@ public class kelondroCollectionIndex { byte[] key; long start = System.currentTimeMillis(); long lastlog = start; - for (int j = 0; j < array.size(); j++) { + for (int j = 0; j < array.USAGE.allCount(); j++) { aentry = array.get(j); key = aentry.getColBytes(0); if (key == null) continue; // skip deleted entries @@ -161,7 +161,7 @@ public class kelondroCollectionIndex { // write a log if (System.currentTimeMillis() - lastlog > 30000) { - serverLog.logFine("STARTUP", "created " + j + " RWI index entries. " + (((System.currentTimeMillis() - start) * (array.size() - j) / j) / 60000) + " minutes remaining for this array"); + serverLog.logFine("STARTUP", "created " + j + " RWI index entries. " + (((System.currentTimeMillis() - start) * (array.USAGE.allCount() - j) / j) / 60000) + " minutes remaining for this array"); lastlog = System.currentTimeMillis(); } } @@ -552,8 +552,8 @@ public class kelondroCollectionIndex { } // printout of index - kelondroFlexTable index = new kelondroFlexTable(path, filenameStub + ".index", buffersize, preloadTime, collectionIndex.indexRow(), kelondroNaturalOrder.naturalOrder); collectionIndex.close(); + kelondroFlexTable index = new kelondroFlexTable(path, filenameStub + ".index", buffersize, preloadTime, collectionIndex.indexRow(), kelondroNaturalOrder.naturalOrder); index.print(); index.close(); } catch (IOException e) { diff --git a/source/de/anomic/kelondro/kelondroFixedWidthArray.java b/source/de/anomic/kelondro/kelondroFixedWidthArray.java index a44f63c66..ee6ef7ba9 100644 --- a/source/de/anomic/kelondro/kelondroFixedWidthArray.java +++ b/source/de/anomic/kelondro/kelondroFixedWidthArray.java @@ -89,7 +89,7 @@ public class kelondroFixedWidthArray extends kelondroRecords implements kelondro // make room for element Node n; - while (size() <= index) { + while (super.USAGE.allCount() <= index) { n = newNode(); n.commit(CP_NONE); }