Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Make Peers more receptible to transferred indexes - Set MaxWordCount for dhtInCache to indexDistribution.dhtReceiptLimit so that the inCache gets flushed when the limit is passed - Modify flushCacheSome to flush enough words to get below MaxWordCount immediately
hermens3f5a4153a066
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex 87c86f10e..5a489ecd6 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -432,6 +432,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser(int) getConfigLong("wordCacheMaxCount", 20000));setConfig("wordCacheMaxCount", Integer.toString(wordCacheMaxCount));wordIndex.setMaxWordCount(wordCacheMaxCount);++ int wordInCacheMaxCount = (int) getConfigLong("indexDistribution.dhtReceiptLimit", 1000);+ wordIndex.setInMaxWordCount(wordInCacheMaxCount);// start a cache managerlog.logConfig("Starting HT Cache Manager");diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex b3025698e..7009100f0 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -178,6 +178,10 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {dhtOutCache.setMaxWordCount(maxWords);}+ public void setInMaxWordCount(int maxWords) {+ dhtInCache.setMaxWordCount(maxWords);+ }+public void setWordFlushDivisor(int idleDivisor, int busyDivisor) {this.idleDivisor = idleDivisor;this.busyDivisor = busyDivisor;@@ -229,9 +233,14 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {}private void flushCacheSome(indexRAMCacheRI ram, boolean busy) {- int flushCount = (busy) ? ram.size() / busyDivisor : ram.size() / idleDivisor;- if (flushCount > 100) flushCount = 100;- if (flushCount < 1) flushCount = Math.min(1, ram.size());+ int flushCount;+ if (ram.size() > ram.getMaxWordCount()) {+ flushCount = ram.size() + 100 - ram.getMaxWordCount();+ } else {+ flushCount = (busy) ? ram.size() / busyDivisor : ram.size() / idleDivisor;+ if (flushCount > 100) flushCount = 100;+ if (flushCount < 1) flushCount = Math.min(1, ram.size());+ }flushCache(ram, flushCount);}