From 6a6c1ed04e78755af222af717ea1d645aa144362 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Sat, 3 Mar 2012 16:38:25 +0000 Subject: [PATCH] wait for leaders on startup for slow/busy comps git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1296659 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/cloud/AbstractDistributedZkTestCase.java | 10 +++++++++- .../org/apache/solr/cloud/BasicDistributedZkTest.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java b/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java index df237b64500..b4f48ccc5fc 100644 --- a/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java +++ b/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java @@ -27,9 +27,9 @@ import org.apache.solr.common.cloud.Slice; import org.apache.solr.common.cloud.SolrZkClient; import org.apache.solr.common.cloud.ZkNodeProps; import org.apache.solr.common.cloud.ZkStateReader; +import org.apache.solr.servlet.SolrDispatchFilter; import org.apache.zookeeper.KeeperException; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; public abstract class AbstractDistributedZkTestCase extends BaseDistributedSearchTestCase { @@ -80,6 +80,14 @@ public abstract class AbstractDistributedZkTestCase extends BaseDistributedSearc } shards = sb.toString(); + + // now wait till we see the leader for each shard + for (int i = 1; i <= numShards; i++) { + ZkStateReader zkStateReader = ((SolrDispatchFilter) jettys.get(0) + .getDispatchFilter().getFilter()).getCores().getZkController() + .getZkStateReader(); + zkStateReader.getLeaderProps("collection1", "shard" + (i + 2), 15000); + } } protected void waitForRecoveriesToFinish(String collection, ZkStateReader zkStateReader, boolean verbose) diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java index 3efa76376da..4a5609ee633 100644 --- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java @@ -314,7 +314,7 @@ public class BasicDistributedZkTest extends AbstractDistributedZkTestCase { NamedList uhandler = (NamedList) uhandlerCat.get("updateHandler"); NamedList stats = (NamedList) uhandler.get("stats"); Long commits = (Long) stats.get("commits"); - System.out.println("resp:" + resp); + return commits; }