Test: testRelocationWithBusyClusterUpdateThread - listener should wait for replicas to be created

This commit is contained in:
Boaz Leskes 2015-02-07 10:51:07 +01:00
parent e684d7fde4
commit 1167beed48

View File

@ -488,15 +488,20 @@ public class RelocationTests extends ElasticsearchIntegrationTest {
internalCluster().getInstance(ClusterService.class, node1).addLast(new ClusterStateListener() {
@Override
public void clusterChanged(ClusterChangedEvent event) {
if (event.state().routingNodes().hasUnassignedShards() == false) {
allReplicasAssigned.countDown();
try {
releaseClusterState.await();
} catch (InterruptedException e) {
//
}
ClusterState state = event.state();
if (state.routingTable().allShards().size() == 1 || state.routingNodes().hasUnassignedShards()) {
// we have no replicas or they are not assigned yet
return;
}
allReplicasAssigned.countDown();
try {
releaseClusterState.await();
} catch (InterruptedException e) {
//
}
}
});
internalCluster().getInstance(ClusterService.class, master).addLast(new ClusterStateListener() {