SOLR-5437

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1541404 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2013-11-13 07:02:36 +00:00
parent a595d71cec
commit 80ad858997
1 changed files with 11 additions and 6 deletions

View File

@ -124,18 +124,23 @@ public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
CloudSolrServer client = createCloudClient(null);
createColl(COLL_NAME, client);
DocCollection testcoll = getCommonCloudSolrServer().getZkStateReader().getClusterState().getCollection(COLL_NAME);
final Slice shard1 = testcoll.getSlices().iterator().next();
if(!shard1.getState().equals(Slice.ACTIVE)) fail("shard is not active");
boolean found = false;
Replica replica1 = null;
for (Replica replica : shard1.getReplicas()) if("active".equals(replica.getStr("state"))) replica1 =replica;
Slice shard1 = null;
Replica replica1 = null;
for (Slice slice : testcoll.getSlices()) {
if("active".equals( slice.getStr("state"))){
shard1 = slice;
for (Replica replica : shard1.getReplicas()) if("active".equals(replica.getStr("state"))) replica1 =replica;
}
}
// final Slice shard1 = testcoll.getSlices().iterator().next();
// if(!shard1.getState().equals(Slice.ACTIVE)) fail("shard is not active");
// for (Replica replica : shard1.getReplicas()) if("active".equals(replica.getStr("state"))) replica1 =replica;
if(replica1 == null) fail("no active relicas found");
removeAndWaitForReplicaGone(COLL_NAME, client, replica1, shard1.getName());
client.shutdown();
}
protected void removeAndWaitForReplicaGone(String COLL_NAME, CloudSolrServer client, Replica replica, String shard) throws SolrServerException, IOException, InterruptedException {