try to recover from an OOM during citation index reading and fail-over

to second solr core in case of unrecoverable OOM.
pull/1/head
Michael Peter Christen 11 years ago
parent 9932c441c8
commit c3dcbdc8d5

@ -539,8 +539,14 @@ public class HeapReader {
try {
blob = new byte[len];
} catch (final OutOfMemoryError e) {
// try once again after GC
MemoryControl.gc(1000, "HeapReader.get()/blob");
try {
blob = new byte[len];
} catch (final OutOfMemoryError ee) {
throw new SpaceExceededException(len, "HeapReader.get()/blob");
}
}
this.file.readFully(blob, 0, blob.length);
return blob;

@ -360,6 +360,7 @@ public class Segment {
this.externalHosts = new RowHandleSet(6, Base64Order.enhancedCoder, 0);
this.internalIDs = new RowHandleSet(12, Base64Order.enhancedCoder, 0);
this.externalIDs = new RowHandleSet(12, Base64Order.enhancedCoder, 0);
try {
if (connectedCitation()) {
// read the references from the citation index
ReferenceContainer<CitationReference> references;
@ -379,6 +380,10 @@ public class Segment {
}
}
}
} catch (SpaceExceededException e) {
// the Citation Index got too large, we ignore the problem and hope that a second solr index is attached which will take over now
if (Segment.this.fulltext.writeToWebgraph()) internalIDs.clear();
}
if ((internalIDs.size() == 0 || !connectedCitation()) && Segment.this.fulltext.writeToWebgraph()) {
// reqd the references from the webgraph
SolrConnector webgraph = Segment.this.fulltext.getWebgraphConnector();

Loading…
Cancel
Save