Skip to content

Commit 082fc45

Browse files
committed
GatewayAllocator: reset rerouting flag after error
After asynchronously fetching shard information the gateway allocator issues a reroute via a cluster state update task. elastic#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 elastic#11519
1 parent 722f8fd commit 082fc45

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/main/java/org/elasticsearch/gateway/local/LocalGatewayAllocator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ public ClusterState execute(ClusterState currentState) throws Exception {
550550

551551
@Override
552552
public void onFailure(String source, Throwable t) {
553+
rerouting.set(false);
553554
logger.warn("failed to perform reroute post async fetch for {}", t, source);
554555
}
555556
});

src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
package org.elasticsearch.cluster;
2121

2222
import com.google.common.base.Predicate;
23-
2423
import org.apache.lucene.util.LuceneTestCase;
2524
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
2625
import org.elasticsearch.client.Client;
@@ -33,7 +32,6 @@
3332
import org.elasticsearch.index.query.QueryBuilders;
3433
import org.elasticsearch.test.ElasticsearchIntegrationTest;
3534
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
36-
import org.elasticsearch.test.junit.annotations.TestLogging;
3735
import org.junit.Test;
3836

3937
import java.util.concurrent.ExecutionException;
@@ -167,7 +165,6 @@ public void run() {
167165
}
168166

169167
@Test @LuceneTestCase.Slow
170-
@TestLogging("cluster.routing.allocation.allocator:TRACE")
171168
public void multipleNodesShutdownNonMasterNodes() throws Exception {
172169
Settings settings = settingsBuilder()
173170
.put("discovery.type", "zen")

0 commit comments

Comments
 (0)