lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1498763 - in /lucene/dev/trunk/solr: core/src/test/org/apache/solr/cloud/ShardSplitTest.java solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
Date Tue, 02 Jul 2013 03:10:45 GMT
Author: markrmiller
Date: Tue Jul  2 03:10:43 2013
New Revision: 1498763

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

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java?rev=1498763&r1=1498762&r2=1498763&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java Tue Jul
 2 03:10:43 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/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1498763&r1=1498762&r2=1498763&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
Tue Jul  2 03:10:43 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



Mime
View raw message