enhanced memory protection and OOM exception handling in Solr connector

pull/1/head
Michael Peter Christen 11 years ago
parent d9858e1b8a
commit 412d55523c

@ -109,9 +109,17 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector {
} else {
// if there is only a single document, send this directly to solr
//ConcurrentLog.info("ConcurrentUpdateSolrConnector", "sending one document to solr");
updateIdCache((String) doc.getFieldValue(CollectionSchema.id.getSolrFieldName()));
try {
updateIdCache((String) doc.getFieldValue(CollectionSchema.id.getSolrFieldName()));
ConcurrentUpdateSolrConnector.this.connector.add(doc);
} catch (final OutOfMemoryError e) {
// clear and try again...
clearCaches();
try {
ConcurrentUpdateSolrConnector.this.connector.add(doc);
} catch (final IOException ee) {
ConcurrentLog.logException(e);
}
} catch (final IOException e) {
ConcurrentLog.logException(e);
}

@ -38,6 +38,7 @@ import net.yacy.search.schema.CollectionSchema;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.client.solrj.SolrQuery;
@ -133,7 +134,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
// clear 'lost' caches
if (ib instanceof SolrCache) ((SolrCache<?,?>) ib).clear();
}
// this.core.getInfoRegistry().clear();
FieldCache.DEFAULT.purgeAllCaches(); // purge the lucene field cache
}
public SolrInstance getInstance() {

@ -71,6 +71,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen
@Override
public void commit(final boolean softCommit) {
if (this.server == null) return;
synchronized (this.server) {
try {
this.server.commit(true, true, softCommit);

Loading…
Cancel
Save