Skip to content

Commit

Permalink
- fixed bad sort behavior of kelondroRowSet, in this case: no sort at…
Browse files Browse the repository at this point in the history
… all!

  see http://forum.yacy-websuche.de/viewtopic.php?p=4841#p4841
- some memory calculation enhancements in kelondroFlex and a little bit more logging

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4378 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jan 23, 2008
1 parent 0b4205e commit 6dc6797
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions source/de/anomic/kelondro/kelondroFlexTable.java
Expand Up @@ -59,9 +59,9 @@ public kelondroFlexTable(File path, String tablename, long preloadTime, kelondro
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");
Expand All @@ -72,7 +72,7 @@ public kelondroFlexTable(File path, String tablename, long preloadTime, kelondro
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
Expand All @@ -81,7 +81,7 @@ public kelondroFlexTable(File path, String tablename, long preloadTime, kelondro
}

// 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-");
Expand Down
8 changes: 4 additions & 4 deletions source/de/anomic/kelondro/kelondroRowSet.java
Expand Up @@ -107,13 +107,13 @@ public synchronized kelondroRow.Entry put(kelondroRow.Entry entry) {
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);
Expand Down

0 comments on commit 6dc6797

Please sign in to comment.