|
@@ -30,6 +30,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
|
|
|
import org.elasticsearch.cluster.metadata.MetaData;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
|
|
+import org.elasticsearch.cluster.routing.RoutingNode;
|
|
|
import org.elasticsearch.cluster.routing.RoutingService;
|
|
|
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|
|
import org.elasticsearch.cluster.service.InternalClusterService;
|
|
@@ -939,14 +940,15 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ClusterState.Builder stateBuilder = ClusterState.builder(currentState);
|
|
|
+
|
|
|
+ // we must return a new cluster state instance to force publishing. This is important
|
|
|
+ // for the joining node to finalize it's join and set us as a master
|
|
|
+ final ClusterState.Builder newState = ClusterState.builder(currentState);
|
|
|
if (nodeAdded) {
|
|
|
- stateBuilder.nodes(nodesBuilder);
|
|
|
+ newState.nodes(nodesBuilder);
|
|
|
}
|
|
|
- currentState = stateBuilder.build();
|
|
|
- // eagerly run reroute to apply the node addition
|
|
|
- RoutingAllocation.Result result = routingService.getAllocationService().reroute(currentState);
|
|
|
- return ClusterState.builder(currentState).routingResult(result).build();
|
|
|
+
|
|
|
+ return newState.build();
|
|
|
}
|
|
|
|
|
|
@Override
|