Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) Bugfix: Prevent wordIndex.getContainer() from returning and even manipulating the containers from the ram cache. Return a new container instead. *) Speedup flushFromMem by reducing the number of searches in the TreeMap
hermens954f02d22e14
diff --git a/source/de/anomic/plasma/plasmaWordIndexCache.java b/source/de/anomic/plasma/plasmaWordIndexCache.javaindex 56d048e0c..2d80b1861 100644--- a/source/de/anomic/plasma/plasmaWordIndexCache.java+++ b/source/de/anomic/plasma/plasmaWordIndexCache.java@@ -364,13 +364,12 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {plasmaWordIndexEntryContainer container = null;long time;synchronized (cache) {- // get the container- container = (plasmaWordIndexEntryContainer) this.cache.get(key);+ // get the container and remove it from cache+ container = (plasmaWordIndexEntryContainer) this.cache.remove(key);if (container == null) return 0; // flushing of nonexisting key- time = getUpdateTime(key);+ time = container.updated();- // remove it from the cache- cache.remove(key);+ // remove it from the MScoreClustershashScore.deleteScore(key);hashDate.deleteScore(key);}@@ -411,9 +410,15 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {plasmaWordIndexEntryContainer container;synchronized (cache) {+ container = new plasmaWordIndexEntryContainer(wordHash);// get from cache- container = (plasmaWordIndexEntryContainer) cache.get(wordHash);- if (container == null) container = new plasmaWordIndexEntryContainer(wordHash);+ // We must not use the container from cache to store everything we find, as that+ // container remains linked to in the cache and might be changed later while the+ // returned container is still in use.+ // e.g. indexTransfer might keep this container for minutes while several new pages+ // could be added to the index, possibly with the same words that have been selected+ // for transfer+ container.add((plasmaWordIndexEntryContainer) cache.get(wordHash));// get from assortmentscontainer.add(assortmentCluster.getFromAll(wordHash, (maxTime < 0) ? -1 : maxTime / 2));