diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-10-03 18:05:08 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-10-03 18:05:08 +0100 |
| commit | 24b140abedb163453a432d047620f30316509c3f (patch) | |
| tree | e4900187d2384b0c3291e9085d4c8d1946e41334 /src | |
| parent | 233d591185dcd45166b49d107a60f44e6c91849c (diff) | |
| parent | 8441608809bb15c72b86707b95a45a10caf6278e (diff) | |
| download | rabbitmq-server-git-24b140abedb163453a432d047620f30316509c3f.tar.gz | |
Merge bug26213 (again)
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_node_monitor.erl | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index b4a429ed0b..f3aa230355 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -330,8 +330,8 @@ handle_cast({node_up, Node, NodeType}, end, add_node(Node, RunningNodes)}), ok = handle_live_rabbit(Node), - {noreply, State#state{ - monitors = pmon:monitor({rabbit, Node}, Monitors)}} + Monitors1 = pmon:monitor({rabbit, Node}, Monitors), + {noreply, maybe_autoheal(State#state{monitors = Monitors1})} end; handle_cast({joined_cluster, Node, NodeType}, State) -> @@ -393,8 +393,7 @@ handle_info({nodedown, Node, Info}, State = #state{node_guids = GUIDs}) -> handle_info({mnesia_system_event, {inconsistent_database, running_partitioned_network, Node}}, State = #state{partitions = Partitions, - monitors = Monitors, - autoheal = AState}) -> + monitors = Monitors}) -> %% We will not get a node_up from this node - yet we should treat it as %% up (mostly). State1 = case pmon:is_monitored({rabbit, Node}, Monitors) of @@ -405,8 +404,7 @@ handle_info({mnesia_system_event, ok = handle_live_rabbit(Node), Partitions1 = ordsets:to_list( ordsets:add_element(Node, ordsets:from_list(Partitions))), - {noreply, State1#state{partitions = Partitions1, - autoheal = rabbit_autoheal:maybe_start(AState)}}; + {noreply, maybe_autoheal(State1#state{partitions = Partitions1})}; handle_info({autoheal_msg, Msg}, State = #state{autoheal = AState, partitions = Partitions}) -> @@ -549,6 +547,15 @@ handle_live_rabbit(Node) -> ok = rabbit_alarm:on_node_up(Node), ok = rabbit_mnesia:on_node_up(Node). +maybe_autoheal(State = #state{partitions = []}) -> + State; + +maybe_autoheal(State = #state{autoheal = AState}) -> + case all_nodes_up() of + true -> State#state{autoheal = rabbit_autoheal:maybe_start(AState)}; + false -> State + end. + %%-------------------------------------------------------------------- %% Internal utils %%-------------------------------------------------------------------- |
