1) Increasing the SolrServer's soTimeOut and ConnectionTimeOut to 10000 ms to fix the SocketTimeOutException : Read timed out.
2) logging the UpdateResponse object's information for debugging purposes in SolrIndexer.
This commit is contained in:
parent
76d0932c58
commit
717275bc38
2 changed files with 13 additions and 8 deletions
|
@ -13,13 +13,13 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.common.SolrDocument;
|
import org.apache.solr.client.solrj.response.UpdateResponse;
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
|
import org.apache.solr.common.SolrException;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.IndexingException;
|
import edu.cornell.mannlib.vitro.webapp.search.IndexingException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.docbuilder.Obj2DocIface;
|
import edu.cornell.mannlib.vitro.webapp.search.docbuilder.Obj2DocIface;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.solr.IndividualToSolrDocument;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexerIface;
|
import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexerIface;
|
||||||
|
|
||||||
public class SolrIndexer implements IndexerIface {
|
public class SolrIndexer implements IndexerIface {
|
||||||
|
@ -60,8 +60,10 @@ public class SolrIndexer implements IndexerIface {
|
||||||
//sending each doc individually is inefficient
|
//sending each doc individually is inefficient
|
||||||
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
|
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
|
||||||
docs.add( solrDoc );
|
docs.add( solrDoc );
|
||||||
server.add( docs );
|
UpdateResponse res = server.add( docs );
|
||||||
|
log.debug("response after adding docs to server: "+ res);
|
||||||
|
|
||||||
|
|
||||||
// if( !newDoc ){
|
// if( !newDoc ){
|
||||||
// server.add( docs );
|
// server.add( docs );
|
||||||
// log.debug("updated " + ind.getName() + " " + ind.getURI());
|
// log.debug("updated " + ind.getName() + " " + ind.getURI());
|
||||||
|
@ -132,9 +134,12 @@ public class SolrIndexer implements IndexerIface {
|
||||||
@Override
|
@Override
|
||||||
public synchronized void endIndexing() {
|
public synchronized void endIndexing() {
|
||||||
try {
|
try {
|
||||||
server.commit();
|
UpdateResponse res = server.commit();
|
||||||
} catch (Exception e) {
|
log.debug("Response after committing to server: "+ res );
|
||||||
|
} catch (SolrServerException e) {
|
||||||
log.error("Could not commit to solr server", e);
|
log.error("Could not commit to solr server", e);
|
||||||
|
} catch(IOException e){
|
||||||
|
log.error("Could not commit to solr server", e);
|
||||||
}finally{
|
}finally{
|
||||||
CalculateParameters.betaMap.clear();
|
CalculateParameters.betaMap.clear();
|
||||||
CalculateParameters.betaMap = null;
|
CalculateParameters.betaMap = null;
|
||||||
|
|
|
@ -57,8 +57,8 @@ public class SolrSetup implements javax.servlet.ServletContextListener{
|
||||||
}
|
}
|
||||||
CommonsHttpSolrServer server;
|
CommonsHttpSolrServer server;
|
||||||
server = new CommonsHttpSolrServer( solrServerUrl );
|
server = new CommonsHttpSolrServer( solrServerUrl );
|
||||||
server.setSoTimeout(1000); // socket read timeout
|
server.setSoTimeout(10000); // socket read timeout
|
||||||
server.setConnectionTimeout(100);
|
server.setConnectionTimeout(10000);
|
||||||
server.setDefaultMaxConnectionsPerHost(100);
|
server.setDefaultMaxConnectionsPerHost(100);
|
||||||
server.setMaxTotalConnections(100);
|
server.setMaxTotalConnections(100);
|
||||||
server.setMaxRetries(1);
|
server.setMaxRetries(1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue