Skip to content

Commit

Permalink
Implement emergency break in index receive when the limit of the ramC…
Browse files Browse the repository at this point in the history
…ache is exceeded by more than cacheLimit

See: http://www.yacy-forum.de/viewtopic.php?p=22911#22911



git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2248 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
hermens committed Jun 27, 2006
1 parent e40987e commit 53cbcc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion htroot/yacy/transferRWI.java
Expand Up @@ -99,6 +99,12 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
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
Expand Down Expand Up @@ -186,4 +192,4 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
// return rewrite properties
return prop;
}
}
}
4 changes: 4 additions & 0 deletions source/de/anomic/plasma/plasmaWordIndex.java
Expand Up @@ -149,6 +149,10 @@ public void setMaxWordCount(int maxWords) {
ramCache.setMaxWordCount(maxWords);
}

public int getMaxWordCount() {
return ramCache.getMaxWordCount();
}

public void flushControl() {
// check for forced flush
synchronized (this) { ramCache.shiftK2W(); }
Expand Down

0 comments on commit 53cbcc6

Please sign in to comment.