Skip to content

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

Implement emergency break in index receive when the limit of the ramCache is exceeded by more than cacheLimit See: http://www.yacy-forum.de/viewtopic.php?p=22911#22911

hermens53cbcc6d6ee9
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java
index fb7346da0..52cbe032f 100644
--- a/htroot/yacy/transferRWI.java
+++ b/htroot/yacy/transferRWI.java
@@ -99,6 +99,12 @@ public final class transferRWI {
granted = false; // don't accept more words if there are too many words to flush
result = "busy";
pause = 60000;
+ } else if (checkLimit && sb.wordIndex.wSize() > (sb.wordIndex.getMaxWordCount() + cachelimit)) {
+ // we are too busy flushing the ramCache to receive indexes
+ sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". We are too busy (wordcachesize=" + sb.wordIndex.wSize() + ").");
+ granted = false; // don't accept more words if there are too many words to flush
+ result = "busy";
+ pause = 300000;
} else {
// we want and can receive indexes
// log value status (currently added to find outOfMemory error
@@ -186,4 +192,4 @@ public final class transferRWI {
// return rewrite properties
return prop;
}
-}
\ No newline at end of file
+}
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 927fb7264..909b78c98 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -149,6 +149,10 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
ramCache.setMaxWordCount(maxWords);
}
+ public int getMaxWordCount() {
+ return ramCache.getMaxWordCount();
+ }
+
public void flushControl() {
// check for forced flush
synchronized (this) { ramCache.shiftK2W(); }