Skip to content

Commit 8dbe18b

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 bd6b9d5 commit 8dbe18b

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
@@ -32,7 +32,6 @@
3232
import org.elasticsearch.index.query.QueryBuilders;
3333
import org.elasticsearch.test.ElasticsearchIntegrationTest;
3434
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
35-
import org.elasticsearch.test.junit.annotations.TestLogging;
3635
import org.junit.Test;
3736

3837
import java.util.concurrent.ExecutionException;
@@ -166,8 +165,6 @@ public void run() {
166165
}
167166

168167
@Test @LuceneTestCase.Slow
169-
@TestLogging("cluster.routing.allocation.allocator:TRACE")
170-
@LuceneTestCase.AwaitsFix(bugUrl = "boaz is looking into this")
171168
public void multipleNodesShutdownNonMasterNodes() throws Exception {
172169
Settings settings = settingsBuilder()
173170
.put("discovery.type", "zen")

0 commit comments

Comments
 (0)