Skip to content

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

fixed bugs

orbiterfdd606c8c8a4
diff --git a/source/de/anomic/plasma/plasmaWordIndexAssortment.java b/source/de/anomic/plasma/plasmaWordIndexAssortment.java
index cff0e385a..5f77f6243 100644
--- a/source/de/anomic/plasma/plasmaWordIndexAssortment.java
+++ b/source/de/anomic/plasma/plasmaWordIndexAssortment.java
@@ -107,7 +107,7 @@ public final class plasmaWordIndexAssortment {
// open existing singeton tree file
try {
assortments = new kelondroTree(assortmentFile, bufferSize);
- log.logSystem("Opened Assortment Database, " + assortments.size() + " entries.");
+ log.logSystem("Opened Assortment Database, " + assortments.size() + " entries, width " + assortmentCapacity);
} catch (IOException e){
log.logError("unable to open assortment database: " + e.getMessage());
e.printStackTrace();
@@ -116,7 +116,7 @@ public final class plasmaWordIndexAssortment {
// create new sigleton tree file
try {
assortments = new kelondroTree(assortmentFile, bufferSize, bufferStructure(assortmentCapacity));
- log.logSystem("Created new Assortment Database");
+ log.logSystem("Created new Assortment Database, width " + assortmentCapacity);
} catch (IOException e){
log.logError("unable to create assortment database: " + e.getMessage());
e.printStackTrace();
diff --git a/source/de/anomic/plasma/plasmaWordIndexCache.java b/source/de/anomic/plasma/plasmaWordIndexCache.java
index 10cb627e4..f3912bbab 100644
--- a/source/de/anomic/plasma/plasmaWordIndexCache.java
+++ b/source/de/anomic/plasma/plasmaWordIndexCache.java
@@ -56,7 +56,7 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
private static final String oldSingletonFileName = "indexSingletons0.db";
private static final String newSingletonFileName = "indexAssortment001.db";
private static final String indexAssortmentClusterPath = "ACLUSTER";
- private static final int assortmentLimit = 6;
+ private static final int assortmentLimit = 8;
// class variables
@@ -317,7 +317,7 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
}
}
- private int flushFromMemToLimit() {
+ private synchronized int flushFromMemToLimit() {
if ((hashScore.size() == 0) && (cache.size() == 0)) {
serverLog.logDebug("PLASMA INDEXING", "flushToLimit: called but cache is empty");
return 0;
@@ -361,7 +361,7 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
count = 0;
// flush high-scores that accumultated too much
- for (int cluster = clusterCandidate.length; cluster >= 100; cluster--) {
+ for (int cluster = clusterCandidate.length; cluster >= 50; cluster--) {
candidateCounter = 0;
i = clusterCandidate[cluster - 1].entrySet().iterator();
while (i.hasNext()) {
@@ -369,16 +369,16 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
key = (String) entry.getValue();
createTime = (Long) entry.getKey();
count += java.lang.Math.abs(flushFromMem(key, false));
- candidateCounter += cluster + 1;
- log.logDebug("flushed high-cluster over limit #" + (cluster + 1) + ", key=" + key + ", count=" + count + ", cachesize=" + cache.size());
+ candidateCounter += cluster;
+ log.logDebug("flushed high-cluster over limit #" + cluster + ", key=" + key + ", count=" + count + ", cachesize=" + cache.size());
}
}
// flush from assortment cluster
- for (int cluster = 0; cluster < assortmentLimit; cluster++) {
+ for (int cluster = 1; cluster <= java.lang.Math.min(clusterCandidate.length, assortmentLimit); cluster++) {
candidateCounter = 0;
// select a specific cluster
- i = clusterCandidate[cluster].entrySet().iterator();
+ i = clusterCandidate[cluster - 1].entrySet().iterator();
// check each element in this flush-list: too old?
while (i.hasNext()) {
entry = (Map.Entry) i.next();
@@ -387,14 +387,12 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
if ((createTime != null) && ((System.currentTimeMillis() - createTime.longValue()) > 90000)) {
//log.logDebug("flushing singleton-key " + key + ", count=" + count + ", cachesize=" + cache.size() + ", singleton-size=" + singletons.size());
count += java.lang.Math.abs(flushFromMem(key, true));
- candidateCounter += cluster + 1;
+ candidateCounter += cluster;
}
- if (count > 2000) {
- if (candidateCounter > 0) log.logDebug("flushed low-cluster #" + (cluster + 1) + ", count=" + count + ", candidateCounter=" + candidateCounter + ", cachesize=" + cache.size());
- return count;
- }
}
- if (candidateCounter > 0) log.logDebug("flushed low-cluster #" + (cluster + 1) + ", count=" + count + ", candidateCounter=" + candidateCounter + ", cachesize=" + cache.size());
+ if (candidateCounter > 0) log.logDebug("flushed low-cluster #" + cluster + ", count=" + count + ", candidateCounter=" + candidateCounter + ", cachesize=" + cache.size());
+ if (count > 1000) return count;
+
}
// stop flushing if cache is shrinked enough
@@ -402,19 +400,19 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
if (cache.size() < this.maxWords) return count;
// flush high-scores
- for (int cluster = 100; cluster >= assortmentLimit; cluster--) {
+ for (int cluster = java.lang.Math.min(clusterCandidate.length, 50); cluster > assortmentLimit; cluster--) {
candidateCounter = 0;
i = clusterCandidate[cluster - 1].entrySet().iterator();
while (i.hasNext()) {
- if (cache.size() < this.maxWords) return count;
- entry = (Map.Entry) i.next();
+ entry = (Map.Entry) i.next();
key = (String) entry.getValue();
createTime = (Long) entry.getKey();
if ((createTime != null) && ((System.currentTimeMillis() - createTime.longValue()) > (600000/cluster))) {
count += java.lang.Math.abs(flushFromMem(key, false));
- candidateCounter += cluster + 1;
- log.logDebug("flushed high-cluster below limit #" + (cluster + 1) + ", key=" + key + ", count=" + count + ", cachesize=" + cache.size());
+ candidateCounter += cluster;
+ log.logDebug("flushed high-cluster below limit #" + cluster + ", key=" + key + ", count=" + count + ", cachesize=" + cache.size());
}
+ if (cache.size() < this.maxWords) return count;
}
}
diff --git a/yacy.init b/yacy.init
index a02d5b5e0..372338968 100644
--- a/yacy.init
+++ b/yacy.init
@@ -442,7 +442,7 @@ ramCacheWiki = 8192
# flushed to disc; this may last some minutes.
# maxWaitingWordFlush gives the number of seconds that the shutdown
# may last for the word flush
-wordCacheMax = 10000
+wordCacheMax = 6000
maxWaitingWordFlush = 180
# Specifies if yacy can be used as transparent http proxy.