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 2012/01/08 18:26:01 UTC
svn commit: r1228900 -
/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySolrCloudTest.java
Author: markrmiller
Date: Sun Jan 8 17:26:01 2012
New Revision: 1228900
URL: http://svn.apache.org/viewvc?rev=1228900&view=rev
Log:
try this wait for the test instead
Modified:
lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySolrCloudTest.java
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySolrCloudTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySolrCloudTest.java?rev=1228900&r1=1228899&r2=1228900&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySolrCloudTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySolrCloudTest.java Sun Jan 8 17:26:01 2012
@@ -17,11 +17,15 @@ package org.apache.solr.cloud;
* limitations under the License.
*/
+import java.io.IOException;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.common.SolrInputDocument;
+import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -106,20 +110,40 @@ public class ChaosMonkeySolrCloudTest ex
}
// try and wait for any replications and what not to finish...
-
- // give a moment to make sure any recoveries have started
- Thread.sleep(12000);
// wait until there are no recoveries...
- waitForRecoveriesToFinish(VERBOSE);
-
-
- commit();
+ waitForThingsToLevelOut();
checkShardConsistency(true);
if (VERBOSE) System.out.println("control docs:" + controlClient.query(new SolrQuery("*:*")).getResults().getNumFound() + "\n\n");
}
+
+ private void waitForThingsToLevelOut() throws KeeperException,
+ InterruptedException, Exception, IOException, URISyntaxException {
+ int cnt = 0;
+ boolean retry = false;
+ do {
+ waitForRecoveriesToFinish(VERBOSE);
+
+ commit();
+
+ updateMappingsFromZk(jettys, clients);
+
+ Set<String> theShards = shardToClient.keySet();
+ String failMessage = null;
+ for (String shard : theShards) {
+ failMessage = checkShardConsistency(shard, false);
+ }
+
+ if (failMessage != null) {
+ retry = true;
+ }
+ cnt++;
+ if (cnt > 10) break;
+ Thread.sleep(4000);
+ } while (retry);
+ }
// skip the randoms - they can deadlock...
protected void indexr(Object... fields) throws Exception {