コード例 #1
0
 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();
 }
コード例 #2
0
 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;
 }