public String prettyPrint() { StringBuilder sb = new StringBuilder("routing_nodes:\n"); for (RoutingNode routingNode : this) { sb.append(routingNode.prettyPrint()); } sb.append("---- unassigned\n"); for (MutableShardRouting shardEntry : unassigned) { sb.append("--------").append(shardEntry.shortSummary()).append('\n'); } return sb.toString(); }
public MutableShardRouting findPrimaryForBackup(MutableShardRouting shard) { assert !shard.primary(); for (RoutingNode routingNode : nodesToShards.values()) { for (MutableShardRouting shardRouting : routingNode) { if (shardRouting.shardId().equals(shard.shardId()) && shardRouting.primary()) { return shardRouting; } } } return null; }