_cat/allocation: Guaranteed to have at least zero shards

This commit is contained in:
Andrew Raines 2014-01-24 16:13:19 -06:00
parent 25b49dd50b
commit 92d4cc13c0
1 changed files with 2 additions and 2 deletions

View File

@ -144,7 +144,7 @@ public class RestAllocationAction extends AbstractCatAction {
for (NodeStats nodeStats : stats.getNodes()) { for (NodeStats nodeStats : stats.getNodes()) {
DiscoveryNode node = nodeStats.getNode(); DiscoveryNode node = nodeStats.getNode();
int shardCount = -1; int shardCount = 0;
if (allocs.containsKey(node.id())) { if (allocs.containsKey(node.id())) {
shardCount = allocs.lget(); shardCount = allocs.lget();
} }
@ -158,7 +158,7 @@ public class RestAllocationAction extends AbstractCatAction {
} }
table.startRow(); table.startRow();
table.addCell(shardCount < 0 ? null : shardCount); table.addCell(shardCount);
table.addCell(used < 0 ? null : new ByteSizeValue(used)); table.addCell(used < 0 ? null : new ByteSizeValue(used));
table.addCell(avail < 0 ? null : new ByteSizeValue(avail)); table.addCell(avail < 0 ? null : new ByteSizeValue(avail));
table.addCell(nodeStats.getFs().getTotal().getTotal()); table.addCell(nodeStats.getFs().getTotal().getTotal());