Skip to content

Commit

Permalink
Merge pull request #679 from basho/feature/handle-down-nodes-consiste…
Browse files Browse the repository at this point in the history
…ntly

Handle down nodes consistently

Reviewed-by: JeetKunDoug
  • Loading branch information
borshop committed Dec 17, 2014
2 parents 6763f50 + 60d0ba1 commit 834251a
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/riak_core_handoff_status.erl
Expand Up @@ -78,21 +78,16 @@ build_handoff_details(NodeOrAll) ->
end,
Active),

case length(FilteredTransfers) of
Details = case length(FilteredTransfers) of
0 -> [clique_status:text("No ongoing transfers.")];
_ ->
Header = clique_status:text("Type Key: O = Ownership, H = Hinted, Rz = Resize, Rp = Repair"),
RingSize = riak_core_ring:num_partitions(Ring),
Table = clique_status:table(
[ row_details(Transfer, RingSize) || Transfer <- FilteredTransfers]),
case DownNodes of
[] ->
[Header, Table];
_ ->
NodesDown = clique_status:alert([clique_status:list("(unreachable)", DownNodes)]),
[Header, Table, NodesDown]
end
end.
[Header, Table]
end,
maybe_add_down_nodes(DownNodes, Details).

row_details(T, RingSize) ->
SourceNode = transfer_info(T, src_node),
Expand Down Expand Up @@ -183,13 +178,8 @@ node_summary() ->
Table = clique_status:table(
[ [ format_node_name(Node) | row_summary(Node, KnownStats, ActiveStats) ] ||
Node <- Nodes]),
case DownNodes of
[] ->
[Header, Table];
_ ->
NodesDown = clique_status:alert([clique_status:list("(unreachable)", DownNodes)]),
[Header, Table, NodesDown]
end.
Summary = [Header, Table],
maybe_add_down_nodes(DownNodes, Summary).

collect_transfer_data() ->
collect_from_all({riak_core_handoff_status, collect_node_transfer_data, []}, 5000).
Expand Down Expand Up @@ -390,3 +380,12 @@ collect_from_all({M, F, A}, Timeout) ->
(_) -> true end, Results),
BadNodes = lists:map(fun({Node, _}) -> Node end, Bad),
{Good, DownNodes ++ BadNodes}.

maybe_add_down_nodes(DownNodes, Output) ->
case DownNodes of
[] ->
Output;
_ ->
NodesDown = clique_status:alert([clique_status:list("(unreachable)", DownNodes)]),
Output ++ [NodesDown]
end.

0 comments on commit 834251a

Please sign in to comment.