Quellcode durchsuchen

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
Boaz Leskes vor 10 Jahren
Ursprung
Commit
6aa27a16c6

+ 1 - 0
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);
                 }
             });

+ 0 - 2
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")