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 01:00:51 UTC

svn commit: r1545465 - in /lucene/dev/branches/branch_4x: ./ 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: Tue Nov 26 00:00:51 2013
New Revision: 1545465

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

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

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1545465&r1=1545464&r2=1545465&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Tue Nov 26 00:00:51 2013
@@ -119,6 +119,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/branches/branch_4x/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java?rev=1545465&r1=1545464&r2=1545465&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java Tue Nov 26 00:00:51 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/branches/branch_4x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1545465&r1=1545464&r2=1545465&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java Tue Nov 26 00:00:51 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