diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-02-17 17:57:12 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-02-17 17:57:12 +0000 |
commit | 2f2d399aae12004abcc24a02efc31191a1302ffa (patch) | |
tree | e2e4bfe259e62c6d48590ce7b519a0c84c7e8384 | |
parent | f4017ab867c0c607a72260b383e081fcde088202 (diff) | |
download | rabbitmq-server-bug26006.tar.gz |
Inform autoheal that a node is down on nodedown not rabbit app down; therefore stop ignoring nodedown in winner_waiting.bug26006
-rw-r--r-- | src/rabbit_autoheal.erl | 2 | ||||
-rw-r--r-- | src/rabbit_node_monitor.erl | 23 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/rabbit_autoheal.erl b/src/rabbit_autoheal.erl index a5b91867..43d35fb5 100644 --- a/src/rabbit_autoheal.erl +++ b/src/rabbit_autoheal.erl @@ -75,8 +75,6 @@ maybe_start(State) -> enabled() -> {ok, autoheal} =:= application:get_env(rabbit, cluster_partition_handling). -node_down(_Node, {winner_waiting, _Nodes, _Notify} = Autoheal) -> - Autoheal; node_down(_Node, not_healing) -> not_healing; node_down(Node, _State) -> diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index 10e68198..56134621 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -268,8 +268,7 @@ handle_info({'DOWN', _MRef, process, Pid, _Reason}, {noreply, State#state{subscribers = pmon:erase(Pid, Subscribers)}}; handle_info({nodedown, Node}, State) -> - ok = handle_dead_node(Node), - {noreply, State}; + {noreply, handle_dead_node(Node, State)}; handle_info({mnesia_system_event, {inconsistent_database, running_partitioned_network, Node}}, @@ -341,7 +340,7 @@ handle_dead_rabbit(Node) -> ok = rabbit_mnesia:on_node_down(Node), ok. -handle_dead_node(_Node) -> +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 %% that we can respond in the same way to "rabbitmqctl stop_app" @@ -354,17 +353,17 @@ handle_dead_node(_Node) -> case application:get_env(rabbit, cluster_partition_handling) of {ok, pause_minority} -> case majority() of - true -> ok; - false -> await_cluster_recovery() + true -> State; + false -> await_cluster_recovery() %% Does not really return end; {ok, ignore} -> - ok; + State; {ok, autoheal} -> - ok; + State#state{autoheal = rabbit_autoheal:node_down(Node, Autoheal)}; {ok, Term} -> rabbit_log:warning("cluster_partition_handling ~p unrecognised, " "assuming 'ignore'~n", [Term]), - ok + State end. await_cluster_recovery() -> @@ -397,8 +396,7 @@ wait_for_cluster_recovery(Nodes) -> wait_for_cluster_recovery(Nodes) end. -handle_dead_rabbit_state(Node, State = #state{partitions = Partitions, - autoheal = Autoheal}) -> +handle_dead_rabbit_state(_Node, State = #state{partitions = Partitions}) -> %% 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 @@ -408,9 +406,8 @@ handle_dead_rabbit_state(Node, State = #state{partitions = Partitions, [] -> []; _ -> Partitions end, - ensure_ping_timer( - State#state{partitions = Partitions1, - autoheal = rabbit_autoheal:node_down(Node, Autoheal)}). + ensure_ping_timer(State#state{partitions = Partitions1}). + ensure_ping_timer(State) -> rabbit_misc:ensure_timer( |