Skip to content

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

- fixed bad sort behavior of kelondroRowSet, in this case: no sort at all! see http://forum.yacy-websuche.de/viewtopic.php?p=4841#p4841 - some memory calculation enhancements in kelondroFlex and a little bit more logging

orbiter6dc679785f59
diff --git a/source/de/anomic/kelondro/kelondroFlexTable.java b/source/de/anomic/kelondro/kelondroFlexTable.java
index cf89c10ba..12d6644b4 100644
--- a/source/de/anomic/kelondro/kelondroFlexTable.java
+++ b/source/de/anomic/kelondro/kelondroFlexTable.java
@@ -59,9 +59,9 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
e2.printStackTrace();
throw new kelondroException(e2.getMessage());
}
-
+ minimumSpace = Math.max(minimumSpace, super.size());
try {
- long neededRAM = (long) ((super.row().column(0).cellwidth + 4) * Math.max(super.size(), minimumSpace) * kelondroRowCollection.growfactor);
+ long neededRAM = 10 * 1024 * 104 + (long) ((super.row().column(0).cellwidth + 4) * minimumSpace * kelondroRowCollection.growfactor);
File newpath = new File(path, tablename);
File indexfile = new File(newpath, "col.000.index");
@@ -72,7 +72,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
System.out.println("*** Last Startup time: " + stt + " milliseconds");
long start = System.currentTimeMillis();
- if (serverMemory.request(neededRAM, true)) {
+ if (serverMemory.request(neededRAM, false)) {
// we can use a RAM index
if (indexfile.exists()) {
// delete existing index file
@@ -81,7 +81,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
}
// fill the index
- System.out.print("*** Loading RAM index for " + size() + " entries from " + newpath);
+ System.out.print("*** Loading RAM index for " + size() + " entries from " + newpath + "; available RAM = " + (serverMemory.available() >> 20) + " MB, allocating " + (neededRAM >> 20) + " MB for index.");
index = initializeRamIndex(minimumSpace);
System.out.println(" -done-");
diff --git a/source/de/anomic/kelondro/kelondroRowSet.java b/source/de/anomic/kelondro/kelondroRowSet.java
index a13438b9b..11296db64 100644
--- a/source/de/anomic/kelondro/kelondroRowSet.java
+++ b/source/de/anomic/kelondro/kelondroRowSet.java
@@ -107,13 +107,13 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroInd
long handle = profile.startWrite();
int index = -1;
kelondroRow.Entry oldentry = null;
+ // when reaching a specific amount of un-sorted entries, re-sort all
+ if ((this.chunkcount - this.sortBound) > collectionReSortLimit) {
+ sort();
+ }
index = find(entry.bytes(), (rowdef.primaryKeyIndex < 0) ? 0 :super.rowdef.colstart[rowdef.primaryKeyIndex], super.rowdef.primaryKeyLength);
if (index < 0) {
super.addUnique(entry);
- // when reaching a specific amount of un-sorted entries, re-sort all
- if ((this.chunkcount - this.sortBound) > collectionReSortLimit) {
- sort();
- }
} else {
oldentry = get(index);
set(index, entry);