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/11/26 00:59:40 UTC

svn commit: r1545464 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/update/SolrCmdDistributor.java core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java

Author: markrmiller
Date: Mon Nov 25 23:59:40 2013
New Revision: 1545464

URL: http://svn.apache.org/r1545464
Log:
SOLR-5503: Retry 'forward to leader' requests less aggressively - rather than on IOException, ConnectException.

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1545464&r1=1545463&r2=1545464&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Mon Nov 25 23:59:40 2013
@@ -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
 ----------------------
 

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=1545464&r1=1545463&r2=1545464&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 Nov 25 23:59:40 2013
@@ -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;
             }
           }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1545464&r1=1545463&r2=1545464&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java Mon Nov 25 23:59:40 2013
@@ -439,10 +439,10 @@ public class SolrCmdDistributorTest exte
     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