From 6aa27a16c6684354654504e8f9c7b42c84d85398 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Fri, 5 Jun 2015 21:21:09 +0200 Subject: [PATCH] GatewayAllocator: reset rerouting flag after error After asynchronously fetching shard information the gateway allocator issues a reroute via a cluster state update task. #11421 introduced an optimization trying to avoid submitting unneeded reroutes when results for many shards come in together. This is done by having a rerouting flag, indicating a pending reroute is coming and thus any new incoming shard info doesn't need to issue a reroute. This flag wasn't reset upon an error in the reroute update task. Most notably - if a master node had to step during to a min_master_node violation, it could reject an ongoing reroute. Lacking to reset the flag causing it to skip any future reroute, when the node became master again. Closes #11519 --- .../main/java/org/elasticsearch/gateway/GatewayAllocator.java | 1 + .../java/org/elasticsearch/cluster/MinimumMasterNodesTests.java | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java b/core/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java index e0e7a847d45..f59e271c04f 100644 --- a/core/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java +++ b/core/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java @@ -544,6 +544,7 @@ public class GatewayAllocator extends AbstractComponent { @Override public void onFailure(String source, Throwable t) { + rerouting.set(false); logger.warn("failed to perform reroute post async fetch for {}", t, source); } }); diff --git a/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java b/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java index 2034dc41b81..68d682ddf7b 100644 --- a/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.discovery.zen.elect.ElectMasterService; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; -import org.elasticsearch.test.junit.annotations.TestLogging; import org.junit.Test; import java.util.concurrent.ExecutionException; @@ -164,7 +163,6 @@ public class MinimumMasterNodesTests extends ElasticsearchIntegrationTest { } @Test @Slow - @TestLogging("cluster.routing.allocation.allocator:TRACE") public void multipleNodesShutdownNonMasterNodes() throws Exception { Settings settings = settingsBuilder() .put("discovery.type", "zen")