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/12/30 02:12:26 UTC

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

Author: markrmiller
Date: Mon Dec 30 01:12:26 2013
New Revision: 1554122

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

Modified:
    lucene/dev/branches/lucene_solr_4_6/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt
    lucene/dev/branches/lucene_solr_4_6/solr/core/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
    lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java

Modified: lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt?rev=1554122&r1=1554121&r2=1554122&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt Mon Dec 30 01:12:26 2013
@@ -88,6 +88,9 @@ Bug Fixes
 * SOLR-4709: The core reload after replication if config files have changed
   can fail due to a race condition. (Mark Miller, Hossman))
 
+* SOLR-5503: Retry 'forward to leader' requests less aggressively - rather 
+  than on IOException and status 500, ConnectException. (Mark Miller)
+  
 Optimizations
 ----------------------  
 

Modified: lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java?rev=1554122&r1=1554121&r2=1554122&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java (original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java Mon Dec 30 01:12:26 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;
@@ -90,11 +92,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/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1554122&r1=1554121&r2=1554122&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java (original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java Mon Dec 30 01:12:26 2013
@@ -351,7 +351,9 @@ public class SolrCmdDistributorTest exte
     long numFoundAfter = solrclient.query(new SolrQuery("*:*")).getResults()
         .getNumFound();
     
-    assertEquals(numFoundBefore + 1, numFoundAfter);
+    // we will get java.net.SocketException: Network is unreachable, which we don't retry on
+    assertEquals(numFoundBefore, numFoundAfter);
+    assertEquals(1, cmdDistrib.getErrors().size());
   }
   
   @Override