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/07/02 05:13:31 UTC

svn commit: r1498764 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java solr/solrj/ solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java

Author: markrmiller
Date: Tue Jul  2 03:13:30 2013
New Revision: 1498764

URL: http://svn.apache.org/r1498764
Log:
SOLR-4933: if shard split fails with 500, wait a while to see if it succeeds on a retry

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java?rev=1498764&r1=1498763&r2=1498764&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java Tue Jul  2 03:13:30 2013
@@ -17,6 +17,15 @@ package org.apache.solr.cloud;
  * limitations under the License.
  */
 
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrRequest;
@@ -41,16 +50,6 @@ import org.apache.zookeeper.KeeperExcept
 import org.junit.After;
 import org.junit.Before;
 
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
 public class ShardSplitTest extends BasicDistributedZkTest {
 
   public static final String SHARD1_0 = SHARD1 + "_0";
@@ -159,7 +158,33 @@ public class ShardSplitTest extends Basi
     }
 
     commit();
-    checkDocCountsAndShardStates(docCounts, numReplicas);
+    
+    try {
+      checkDocCountsAndShardStates(docCounts, numReplicas);
+    } catch (HttpSolrServer.RemoteSolrException e) {
+      if (e.code() != 500) {
+        throw e;
+      }
+      
+      // if we get a 500 error, the split should be retried ... let's wait and see if it works...
+      Slice slice1_0 = null, slice1_1 = null;
+      int i = 0;
+      for (i = 0; i < 60; i++) {
+        ZkStateReader zkStateReader = cloudClient.getZkStateReader();
+        zkStateReader.updateClusterState(true);
+        clusterState = zkStateReader.getClusterState();
+        slice1_0 = clusterState.getSlice(AbstractDistribZkTestBase.DEFAULT_COLLECTION, "shard1_0");
+        slice1_1 = clusterState.getSlice(AbstractDistribZkTestBase.DEFAULT_COLLECTION, "shard1_1");
+        if (slice1_0 != null  && slice1_1 != null) {
+          break;
+        }
+        Thread.sleep(500);
+      }
+
+      if (slice1_0 == null  || slice1_1 == null) {
+        throw e;
+      }
+    }
 
     // todo can't call waitForThingsToLevelOut because it looks for jettys of all shards
     // and the new sub-shards don't have any.

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1498764&r1=1498763&r2=1498764&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java Tue Jul  2 03:13:30 2013
@@ -658,7 +658,7 @@ public class HttpSolrServer extends Solr
    * status code that may have been returned by the remote server or a 
    * proxy along the way.
    */
-  protected static class RemoteSolrException extends SolrException {
+  public static class RemoteSolrException extends SolrException {
     /**
      * @param code Arbitrary HTTP status code
      * @param msg Exception Message