Cat api: added node id column to _cat/shards response

closes #10226
This commit is contained in:
Leonardo Menezes 2015-03-24 23:19:57 +01:00 committed by Luca Cavanna
parent 5a475d21e5
commit bad60cea13
2 changed files with 76 additions and 0 deletions

View File

@ -1,4 +1,73 @@
--- ---
"Help":
- do:
cat.shards:
help: true
- match:
$body: |
/^ index .+ \n
shard .+ \n
prirep .+ \n
state .+ \n
docs .+ \n
store .+ \n
ip .+ \n
id .+ \n
node .+ \n
completion.size .+ \n
fielddata.memory_size .+ \n
fielddata.evictions .+ \n
filter_cache.memory_size .+ \n
filter_cache.evictions .+ \n
flush.total .+ \n
flush.total_time .+ \n
get.current .+ \n
get.time .+ \n
get.total .+ \n
get.exists_time .+ \n
get.exists_total .+ \n
get.missing_time .+ \n
get.missing_total .+ \n
id_cache.memory_size .+ \n
indexing.delete_current .+ \n
indexing.delete_time .+ \n
indexing.delete_total .+ \n
indexing.index_current .+ \n
indexing.index_time .+ \n
indexing.index_total .+ \n
merges.current .+ \n
merges.current_docs .+ \n
merges.current_size .+ \n
merges.total .+ \n
merges.total_docs .+ \n
merges.total_size .+ \n
merges.total_time .+ \n
percolate.current .+ \n
percolate.memory_size .+ \n
percolate.queries .+ \n
percolate.time .+ \n
percolate.total .+ \n
refresh.total .+ \n
refresh.time .+ \n
search.fetch_current .+ \n
search.fetch_time .+ \n
search.fetch_total .+ \n
search.open_contexts .+ \n
search.query_current .+ \n
search.query_time .+ \n
search.query_total .+ \n
segments.count .+ \n
segments.memory .+ \n
segments.index_writer_memory .+ \n
segments.index_writer_max_memory .+ \n
segments.version_map_memory .+ \n
segments.fixed_bitset_memory .+ \n
warmer.current .+ \n
warmer.total .+ \n
warmer.total_time .+ \n
$/
---
"Test cat shards output": "Test cat shards output":
- do: - do:

View File

@ -86,6 +86,7 @@ public class RestShardsAction extends AbstractCatAction {
.addCell("docs", "alias:d,dc;text-align:right;desc:number of docs in shard") .addCell("docs", "alias:d,dc;text-align:right;desc:number of docs in shard")
.addCell("store", "alias:sto;text-align:right;desc:store size of shard (how much disk it uses)") .addCell("store", "alias:sto;text-align:right;desc:store size of shard (how much disk it uses)")
.addCell("ip", "default:true;desc:ip of node where it lives") .addCell("ip", "default:true;desc:ip of node where it lives")
.addCell("id", "default:false;desc:unique id of node where it lives")
.addCell("node", "default:true;alias:n;desc:name of node where it lives"); .addCell("node", "default:true;alias:n;desc:name of node where it lives");
table.addCell("completion.size", "alias:cs,completionSize;default:false;text-align:right;desc:size of completion"); table.addCell("completion.size", "alias:cs,completionSize;default:false;text-align:right;desc:size of completion");
@ -186,21 +187,27 @@ public class RestShardsAction extends AbstractCatAction {
table.addCell(shardStats == null ? null : shardStats.getStore().getSize()); table.addCell(shardStats == null ? null : shardStats.getStore().getSize());
if (shard.assignedToNode()) { if (shard.assignedToNode()) {
String ip = state.getState().nodes().get(shard.currentNodeId()).getHostAddress(); String ip = state.getState().nodes().get(shard.currentNodeId()).getHostAddress();
String nodeId = shard.currentNodeId();
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();
name.append(state.getState().nodes().get(shard.currentNodeId()).name()); name.append(state.getState().nodes().get(shard.currentNodeId()).name());
if (shard.relocating()) { if (shard.relocating()) {
String reloIp = state.getState().nodes().get(shard.relocatingNodeId()).getHostAddress(); String reloIp = state.getState().nodes().get(shard.relocatingNodeId()).getHostAddress();
String reloNme = state.getState().nodes().get(shard.relocatingNodeId()).name(); String reloNme = state.getState().nodes().get(shard.relocatingNodeId()).name();
String reloNodeId = shard.relocatingNodeId();
name.append(" -> "); name.append(" -> ");
name.append(reloIp); name.append(reloIp);
name.append(" "); name.append(" ");
name.append(reloNodeId);
name.append(" ");
name.append(reloNme); name.append(reloNme);
} }
table.addCell(ip); table.addCell(ip);
table.addCell(nodeId);
table.addCell(name); table.addCell(name);
} else { } else {
table.addCell(null); table.addCell(null);
table.addCell(null); table.addCell(null);
table.addCell(null);
} }
table.addCell(shardStats == null ? null : shardStats.getCompletion().getSize()); table.addCell(shardStats == null ? null : shardStats.getCompletion().getSize());