From e1bf65c892e7baf6a5d3ab4529c867057ce17a6a Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 26 Feb 2014 23:02:56 +0100 Subject: [PATCH] added short memory protection during postprocessing --- .../yacy/search/schema/CollectionConfiguration.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.java index 85451fbe9..0a518bfee 100644 --- a/source/net/yacy/search/schema/CollectionConfiguration.java +++ b/source/net/yacy/search/schema/CollectionConfiguration.java @@ -79,6 +79,7 @@ import net.yacy.kelondro.data.meta.URIMetadataRow; import net.yacy.kelondro.index.RowHandleMap; import net.yacy.kelondro.rwi.ReferenceContainer; import net.yacy.kelondro.util.Bitfield; +import net.yacy.kelondro.util.MemoryControl; import net.yacy.search.index.Segment; import net.yacy.search.index.Segment.ClickdepthCache; import net.yacy.search.index.Segment.ReferenceReport; @@ -976,6 +977,10 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri } } patchquerycountcheck++; + if (MemoryControl.shortStatus()) { + ConcurrentLog.warn("CollectionConfiguration", "terminated canonical collection during postprocessing because of short memory"); + break; + } } } catch (InterruptedException e) { ConcurrentLog.logException(e); @@ -992,12 +997,20 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri while (convergence_attempts++ < 30) { ConcurrentLog.info("CollectionConfiguration", "convergence step " + convergence_attempts + " for host " + host + " ..."); if (crh.convergenceStep()) break; + if (MemoryControl.shortStatus()) { + ConcurrentLog.warn("CollectionConfiguration", "terminated convergenceStep during postprocessing because of short memory"); + break; + } } ConcurrentLog.info("CollectionConfiguration", "convergence for host " + host + " after " + convergence_attempts + " steps"); // we have now the cr for all documents of a specific host; we store them for later use Map crn = crh.normalize(); //crh.log(crn); ranking.putAll(crn); // accumulate this here for usage in document update later + if (MemoryControl.shortStatus()) { + ConcurrentLog.warn("CollectionConfiguration", "terminated crn akkumulation during postprocessing because of short memory"); + break; + } countcheck++; } if (hostscore.size() != countcheck) ConcurrentLog.warn("CollectionConfiguration", "ambiguous host count: expected=" + hostscore.size() + ", counted=" + countcheck);