Add relocation info to _cat/shards.

This commit is contained in:
Andrew Raines 2013-07-02 23:18:27 -05:00
parent 8a90f4b5ff
commit 750f20d9d4
1 changed files with 9 additions and 3 deletions

View File

@ -108,17 +108,23 @@ public class RestShardsAction extends BaseRestHandler {
for (ShardRouting shard : state.getState().routingTable().allShards()) {
Row row = new Row();
String pri = "r";
String host = "";
StringBuilder host = new StringBuilder();
String docs = "";
String size = "";
String bytes = "";
String nodeName = "";
if (shard.assignedToNode()) {
host = ((InetSocketTransportAddress) state.getState().nodes().get(shard.currentNodeId()).address()).address().getHostString();
host.append(((InetSocketTransportAddress) state.getState().nodes().get(shard.currentNodeId()).address()).address().getHostString());
nodeName = state.getState().nodes().get(shard.currentNodeId()).name();
}
if (shard.relocating()) {
host.append(" -> ");
host.append(((InetSocketTransportAddress) state.getState().nodes().get(shard.relocatingNodeId()).address()).address().getHostString());
host.append(state.getState().nodes().get(shard.relocatingNodeId()).name());
}
if (null != stats.asMap().get(shard.globalId())) {
size = stats.asMap().get(shard.globalId()).getStore().size().toString();
bytes = new Long(stats.asMap().get(shard.globalId()).getStore().getSizeInBytes()).toString();
@ -136,7 +142,7 @@ public class RestShardsAction extends BaseRestHandler {
.addCell(docs)
.addCell(size)
.addCell(bytes)
.addCell(host)
.addCell(host.toString())
.addCell(nodeName);
tab.addRow(row);
}