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
pull/1/head
orbiter 18 years ago
parent 1841ce0895
commit 29a1318ef9

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

@ -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) {

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

Loading…
Cancel
Save