You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2013/10/28 21:43:46 UTC
svn commit: r1536511 - in
/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update:
SolrCmdDistributor.java StreamingSolrServers.java
Author: markrmiller
Date: Mon Oct 28 20:43:46 2013
New Revision: 1536511
URL: http://svn.apache.org/r1536511
Log:
SOLR-5397: If a retry fails, *always* finish the rest of the retries
Modified:
lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java?rev=1536511&r1=1536510&r2=1536511&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java Mon Oct 28 20:43:46 2013
@@ -72,46 +72,51 @@ public class SolrCmdDistributor {
allErrors.addAll(errors);
boolean blockUntilFinishedAgain = false;
for (Error err : errors) {
- String oldNodeUrl = err.req.node.getUrl();
-
- // if there is a retry url, we want to retry...
- boolean isRetry = err.req.node.checkRetry();
- boolean doRetry = false;
- int rspCode = err.statusCode;
-
- if (testing_errorHook != null) Diagnostics.call(testing_errorHook, err.e);
-
- // this can happen in certain situations such as shutdown
- if (isRetry) {
- if (rspCode == 404 || rspCode == 403 || rspCode == 503
- || rspCode == 500) {
- doRetry = true;
- }
+ try {
+ String oldNodeUrl = err.req.node.getUrl();
+
+ // if there is a retry url, we want to retry...
+ boolean isRetry = err.req.node.checkRetry();
+ boolean doRetry = false;
+ int rspCode = err.statusCode;
- // if its an ioexception, lets try again
- if (err.e instanceof IOException) {
- doRetry = true;
- } else if (err.e instanceof SolrServerException) {
- if (((SolrServerException) err.e).getRootCause() instanceof IOException) {
+ if (testing_errorHook != null) Diagnostics.call(testing_errorHook,
+ err.e);
+
+ // this can happen in certain situations such as shutdown
+ if (isRetry) {
+ if (rspCode == 404 || rspCode == 403 || rspCode == 503
+ || rspCode == 500) {
doRetry = true;
}
- }
- }
-
- if (isRetry && err.req.retries < MAX_RETRIES_ON_FORWARD && doRetry) {
- err.req.retries++;
-
- SolrException.log(SolrCmdDistributor.log, "forwarding update to "
- + oldNodeUrl + " failed - retrying ... ");
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- log.warn(null, e);
+
+ // if its an ioexception, lets try again
+ if (err.e instanceof IOException) {
+ doRetry = true;
+ } else if (err.e instanceof SolrServerException) {
+ if (((SolrServerException) err.e).getRootCause() instanceof IOException) {
+ doRetry = true;
+ }
+ }
}
- submit(err.req);
- blockUntilFinishedAgain = true;
+ if (isRetry && err.req.retries < MAX_RETRIES_ON_FORWARD && doRetry) {
+ err.req.retries++;
+
+ SolrException.log(SolrCmdDistributor.log, "forwarding update to "
+ + oldNodeUrl + " failed - retrying ... ");
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ log.warn(null, e);
+ }
+
+ submit(err.req);
+ blockUntilFinishedAgain = true;
+ }
+ } catch (Exception e) {
+ SolrException.log(log, "Retry attempt failed", e);
}
}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java?rev=1536511&r1=1536510&r2=1536511&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java Mon Oct 28 20:43:46 2013
@@ -32,13 +32,12 @@ import org.apache.solr.client.solrj.impl
import org.apache.solr.client.solrj.impl.HttpClientUtil;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.util.JavaBinCodec;
import org.apache.solr.update.SolrCmdDistributor.Error;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class StreamingSolrServers {
- public static Logger scdlog = LoggerFactory.getLogger(SolrCmdDistributor.class);
+ public static Logger log = LoggerFactory.getLogger(StreamingSolrServers.class);
private static HttpClient httpClient;
static {
@@ -73,7 +72,7 @@ public class StreamingSolrServers {
server = new ConcurrentUpdateSolrServer(url, httpClient, 100, 1, updateExecutor) {
@Override
public void handleError(Throwable ex) {
- scdlog.error("error", ex);
+ log.error("error", ex);
Error error = new Error();
error.e = (Exception) ex;
if (ex instanceof SolrException) {