SOLR-5397: If a retry fails, *always* finish the rest of the retries

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1536511 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-10-28 20:43:46 +00:00
parent 8d40d4d2c6
commit 03ed51acef
2 changed files with 42 additions and 38 deletions

View File

@ -72,6 +72,7 @@ public class SolrCmdDistributor {
allErrors.addAll(errors);
boolean blockUntilFinishedAgain = false;
for (Error err : errors) {
try {
String oldNodeUrl = err.req.node.getUrl();
// if there is a retry url, we want to retry...
@ -79,7 +80,8 @@ public class SolrCmdDistributor {
boolean doRetry = false;
int rspCode = err.statusCode;
if (testing_errorHook != null) Diagnostics.call(testing_errorHook, err.e);
if (testing_errorHook != null) Diagnostics.call(testing_errorHook,
err.e);
// this can happen in certain situations such as shutdown
if (isRetry) {
@ -113,6 +115,9 @@ public class SolrCmdDistributor {
submit(err.req);
blockUntilFinishedAgain = true;
}
} catch (Exception e) {
SolrException.log(log, "Retry attempt failed", e);
}
}
servers.clearErrors();

View File

@ -32,13 +32,12 @@ import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer;
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) {