also retry when there are no routing shards, might happen in case of recovery from gateway before shard routing initialization

This commit is contained in:
kimchy 2010-11-14 20:09:00 +02:00
parent d0ac9087b6
commit 37335bc6a9
2 changed files with 28 additions and 2 deletions

View File

@ -267,6 +267,12 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
return true;
}
// no shards, might be in the case between index gateway recovery and shards initialization
if (shards.size() == 0) {
retry(fromClusterEvent, shards.shardId());
return false;
}
boolean foundPrimary = false;
for (final ShardRouting shard : shards) {
// we only deal with primary shards here...

View File

@ -145,10 +145,28 @@ public class RollingRestartStressTest {
if (clearNodeWork) {
FileSystemUtils.deleteRecursively(nodeWork);
}
try {
ClusterHealthResponse clusterHealth = client.client().admin().cluster().prepareHealth()
.setWaitForGreenStatus()
.setWaitForNodes(Integer.toString(numberOfNodes + 0 /* client node*/))
.setWaitForRelocatingShards(0)
.setTimeout("10m").execute().actionGet();
if (clusterHealth.timedOut()) {
logger.warn("timed out waiting for green status....");
}
} catch (Exception e) {
logger.warn("failed to execute cluster health....");
}
nodes[nodeIndex] = NodeBuilder.nodeBuilder().settings(settings).node();
try {
ClusterHealthResponse clusterHealth = client.client().admin().cluster().prepareHealth().setWaitForGreenStatus().setTimeout("10m").execute().actionGet();
ClusterHealthResponse clusterHealth = client.client().admin().cluster().prepareHealth()
.setWaitForGreenStatus()
.setWaitForNodes(Integer.toString(numberOfNodes + 1 /* client node*/))
.setWaitForRelocatingShards(0)
.setTimeout("10m").execute().actionGet();
if (clusterHealth.timedOut()) {
logger.warn("timed out waiting for green status....");
}
@ -242,6 +260,8 @@ public class RollingRestartStressTest {
}
public static void main(String[] args) throws Exception {
System.setProperty("es.logger.prefix", "");
Settings settings = ImmutableSettings.settingsBuilder()
.put("index.shard.check_index", true)
.put("gateway.type", "none")
@ -250,7 +270,7 @@ public class RollingRestartStressTest {
RollingRestartStressTest test = new RollingRestartStressTest()
.settings(settings)
.numberOfNodes(4)
.initialNumberOfDocs(100000)
.initialNumberOfDocs(1000)
.textTokens(150)
.numberOfFields(10)
.cleanNodeWork(true)