mirror of https://github.com/apache/lucene.git
SOLR-5503: Retry 'forward to leader' requests less aggressively - rather than on IOException, ConnectException.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1545464 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
59186c5ae7
commit
8f94ae68de
|
@ -151,6 +151,9 @@ Bug Fixes
|
|||
HttpClients and ensure all http connection managers get shutdown.
|
||||
(Mark Miller)
|
||||
|
||||
* SOLR-5503: Retry 'forward to leader' requests less aggressively - rather
|
||||
than on IOException and status 500, ConnectException. (Mark Miller)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -18,12 +18,14 @@ package org.apache.solr.update;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrServer;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrServer.RemoteSolrException;
|
||||
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
|
||||
import org.apache.solr.client.solrj.request.UpdateRequest;
|
||||
import org.apache.solr.common.SolrException;
|
||||
|
@ -98,11 +100,16 @@ public class SolrCmdDistributor {
|
|||
doRetry = true;
|
||||
}
|
||||
|
||||
// if its an ioexception, lets try again
|
||||
if (err.e instanceof IOException) {
|
||||
// if its a connect exception, lets try again
|
||||
if (err.e instanceof ConnectException) {
|
||||
doRetry = true;
|
||||
} else if (err.e instanceof SolrServerException) {
|
||||
if (((SolrServerException) err.e).getRootCause() instanceof IOException) {
|
||||
if (((SolrServerException) err.e).getRootCause() instanceof ConnectException) {
|
||||
doRetry = true;
|
||||
}
|
||||
} else if (err.e instanceof RemoteSolrException) {
|
||||
Exception cause = (RemoteSolrException) err.e.getCause();
|
||||
if (cause != null && cause instanceof ConnectException) {
|
||||
doRetry = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -439,10 +439,10 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
|
|||
long numFoundAfter = solrclient.query(new SolrQuery("*:*")).getResults()
|
||||
.getNumFound();
|
||||
|
||||
// we will get java.net.SocketException: Network is unreachable and then retry
|
||||
assertEquals(numFoundBefore + 1, numFoundAfter);
|
||||
// we will get java.net.SocketException: Network is unreachable and not retry
|
||||
assertEquals(numFoundBefore, numFoundAfter);
|
||||
|
||||
assertEquals(0, cmdDistrib.getErrors().size());
|
||||
assertEquals(1, cmdDistrib.getErrors().size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue