Removing a node with TRACE logging enabled causes cluster state not to be properly updated, closes #1626.
This commit is contained in:
parent
2eeb609353
commit
a1a30226ca
|
@ -31,15 +31,18 @@ import static com.google.common.collect.Lists.newArrayList;
|
|||
*/
|
||||
public class RoutingNode implements Iterable<MutableShardRouting> {
|
||||
|
||||
private final String nodeId;
|
||||
|
||||
private final DiscoveryNode node;
|
||||
|
||||
private final List<MutableShardRouting> shards;
|
||||
|
||||
public RoutingNode(DiscoveryNode node) {
|
||||
this(node, new ArrayList<MutableShardRouting>());
|
||||
public RoutingNode(String nodeId, DiscoveryNode node) {
|
||||
this(nodeId, node, new ArrayList<MutableShardRouting>());
|
||||
}
|
||||
|
||||
public RoutingNode(DiscoveryNode node, List<MutableShardRouting> shards) {
|
||||
public RoutingNode(String nodeId, DiscoveryNode node, List<MutableShardRouting> shards) {
|
||||
this.nodeId = nodeId;
|
||||
this.node = node;
|
||||
this.shards = shards;
|
||||
}
|
||||
|
@ -54,7 +57,7 @@ public class RoutingNode implements Iterable<MutableShardRouting> {
|
|||
}
|
||||
|
||||
public String nodeId() {
|
||||
return this.node.id();
|
||||
return this.nodeId;
|
||||
}
|
||||
|
||||
public List<MutableShardRouting> shards() {
|
||||
|
@ -140,7 +143,7 @@ public class RoutingNode implements Iterable<MutableShardRouting> {
|
|||
|
||||
public String prettyPrint() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("-----node_id[").append(node.id()).append("]\n");
|
||||
sb.append("-----node_id[").append(nodeId).append("][" + (node == null ? "X" : "V") + "]\n");
|
||||
for (MutableShardRouting entry : shards) {
|
||||
sb.append("--------").append(entry.shortSummary()).append('\n');
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class RoutingNodes implements Iterable<RoutingNode> {
|
|||
}
|
||||
for (Map.Entry<String, List<MutableShardRouting>> entry : nodesToShards.entrySet()) {
|
||||
String nodeId = entry.getKey();
|
||||
this.nodesToShards.put(nodeId, new RoutingNode(clusterState.nodes().get(nodeId), entry.getValue()));
|
||||
this.nodesToShards.put(nodeId, new RoutingNode(nodeId, clusterState.nodes().get(nodeId), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ public class AllocationService extends AbstractComponent {
|
|||
private void applyNewNodes(RoutingNodes routingNodes, Iterable<DiscoveryNode> liveNodes) {
|
||||
for (DiscoveryNode node : liveNodes) {
|
||||
if (!routingNodes.nodesToShards().containsKey(node.id())) {
|
||||
RoutingNode routingNode = new RoutingNode(node);
|
||||
RoutingNode routingNode = new RoutingNode(node.id(), node);
|
||||
routingNodes.nodesToShards().put(node.id(), routingNode);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue