diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-02-26 10:11:08 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-02-26 10:11:08 +0000 |
| commit | 05b62c27143e980529da39c552c90aae0f810539 (patch) | |
| tree | c5d0a415347b62b284b068c19ba78f878985c96a | |
| parent | e901def37a635b16a4d45b557fecf6409ee35d00 (diff) | |
| download | rabbitmq-server-git-05b62c27143e980529da39c552c90aae0f810539.tar.gz | |
Refactor: distinction between handle_dead_rabbit and handle_dead_rabbit_state is not very useful.
| -rw-r--r-- | src/rabbit_node_monitor.erl | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index faf36d210d..c47e9b24d2 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -257,9 +257,8 @@ handle_info({'DOWN', _MRef, process, {rabbit, Node}, _Reason}, rabbit_log:info("rabbit on node ~p down~n", [Node]), {AllNodes, DiscNodes, RunningNodes} = read_cluster_status(), write_cluster_status({AllNodes, DiscNodes, del_node(Node, RunningNodes)}), - ok = handle_dead_rabbit(Node), [P ! {node_down, Node} || P <- pmon:monitored(Subscribers)], - {noreply, handle_dead_rabbit_state( + {noreply, handle_dead_rabbit( Node, State#state{monitors = pmon:erase({rabbit, Node}, Monitors)})}; @@ -332,16 +331,6 @@ code_change(_OldVsn, State, _Extra) -> %% Functions that call the module specific hooks when nodes go up/down %%---------------------------------------------------------------------------- -%% TODO: This may turn out to be a performance hog when there are lots -%% of nodes. We really only need to execute some of these statements -%% on *one* node, rather than all of them. -handle_dead_rabbit(Node) -> - ok = rabbit_networking:on_node_down(Node), - ok = rabbit_amqqueue:on_node_down(Node), - ok = rabbit_alarm:on_node_down(Node), - ok = rabbit_mnesia:on_node_down(Node), - ok. - handle_dead_node(Node, State = #state{autoheal = Autoheal}) -> %% In general in rabbit_node_monitor we care about whether the %% rabbit application is up rather than the node; we do this so @@ -398,7 +387,14 @@ wait_for_cluster_recovery(Nodes) -> wait_for_cluster_recovery(Nodes) end. -handle_dead_rabbit_state(_Node, State = #state{partitions = Partitions}) -> +handle_dead_rabbit(Node, State = #state{partitions = Partitions}) -> + %% TODO: This may turn out to be a performance hog when there are + %% lots of nodes. We really only need to execute some of these + %% statements on *one* node, rather than all of them. + ok = rabbit_networking:on_node_down(Node), + ok = rabbit_amqqueue:on_node_down(Node), + ok = rabbit_alarm:on_node_down(Node), + ok = rabbit_mnesia:on_node_down(Node), %% If we have been partitioned, and we are now in the only remaining %% partition, we no longer care about partitions - forget them. Note %% that we do not attempt to deal with individual (other) partitions |
