Skip to content

Commit

Permalink
some fixes to bring back lulabads peer..
Browse files Browse the repository at this point in the history
  • Loading branch information
orbiter committed Jan 22, 2008
1 parent f4799c2 commit d372a78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/de/anomic/kelondro/kelondroCollectionIndex.java
Expand Up @@ -153,7 +153,7 @@ public kelondroCollectionIndex(File path, String filenameStub, int keyLength, ke
continue;
}
}
serverLog.logFine("STARTUP", "STARTED INITIALIZATION OF NEW COLLECTION INDEX WITH " + initialSpace + " ENTRIES. THIS WILL TAKE SOME TIME");
serverLog.logFine("STARTUP", "STARTED INITIALIZATION OF NEW COLLECTION INDEX WITH " + initialSpace + " ENTRIES. THIS WILL TAKE SOME TIME. " + (serverMemory.available() / 1024 / 1024) + "MB AVAILABLE.");
kelondroRow indexRowdef = indexRow(keyLength, indexOrder);
long necessaryRAM4fullTable = minimumRAM4Eco + (indexRowdef.objectsize + 4) * initialSpace * 3 / 2;
long necessaryRAM4fullIndex = minimumRAM4Eco + (indexRowdef.primaryKeyLength + 4) * initialSpace * 3 / 2;
Expand Down
7 changes: 4 additions & 3 deletions source/de/anomic/kelondro/kelondroEcoTable.java
Expand Up @@ -76,7 +76,7 @@ public kelondroEcoTable(File tablefile, kelondroRow rowdef, int useTailCache, in
for (int i = 0; i < cols.length; i++) {
cols[i] = rowdef.column(i + 1);
}
this.taildef = new kelondroRow(cols, kelondroNaturalOrder.naturalOrder, rowdef.primaryKeyIndex);
this.taildef = new kelondroRow(cols, kelondroNaturalOrder.naturalOrder, -1);

// initialize table file
if (!tablefile.exists()) {
Expand All @@ -97,11 +97,12 @@ public kelondroEcoTable(File tablefile, kelondroRow rowdef, int useTailCache, in

// initialize index and copy table
int records = (int) Math.max(file.size(), initialSpace);
long neededRAM4table = 10 * 1024 * 1024 + records * (rowdef.objectsize + 4) * 3 / 2;
long neededRAM4table = 200 * 1024 * 1024 + records * (rowdef.objectsize + 4) * 3 / 2;
table = ((neededRAM4table < maxarraylength) &&
((useTailCache == tailCacheForceUsage) ||
((useTailCache == tailCacheUsageAuto) && (serverMemory.request(neededRAM4table, true))))) ?
((useTailCache == tailCacheUsageAuto) && (serverMemory.request(neededRAM4table, false))))) ?
new kelondroRowSet(taildef, records) : null;
System.out.println("*** DEBUG: available RAM: " + (serverMemory.available() / 1024 / 1024) + "MB, allocating space for " + records + " entries");
index = new kelondroBytesIntMap(rowdef.primaryKeyLength, rowdef.objectOrder, records);
System.out.println("*** DEBUG: EcoTable " + tablefile.toString() + " has table copy " + ((table == null) ? "DISABLED" : "ENABLED"));

Expand Down
1 change: 1 addition & 0 deletions source/de/anomic/kelondro/kelondroRAMIndex.java
Expand Up @@ -48,6 +48,7 @@ public void reset() {
}

public void reset(int initialspace) {
this.index0 = null; // first flush RAM to make room
this.index0 = new kelondroRowSet(rowdef, initialspace);
this.index1 = null; // to show that this is the initialization phase
}
Expand Down

0 comments on commit d372a78

Please sign in to comment.