summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_autoheal.erl9
-rw-r--r--src/rabbit_node_monitor.erl12
2 files changed, 15 insertions, 6 deletions
diff --git a/src/rabbit_autoheal.erl b/src/rabbit_autoheal.erl
index 90458741..8b292bb5 100644
--- a/src/rabbit_autoheal.erl
+++ b/src/rabbit_autoheal.erl
@@ -16,7 +16,8 @@
-module(rabbit_autoheal).
--export([init/0, maybe_start/1, rabbit_down/2, node_down/2, handle_msg/3]).
+-export([init/0, enabled/0, maybe_start/1, rabbit_down/2, node_down/2,
+ handle_msg/3]).
%% The named process we are running in.
-define(SERVER, rabbit_node_monitor).
@@ -80,7 +81,11 @@ maybe_start(State) ->
State.
enabled() ->
- {ok, autoheal} =:= application:get_env(rabbit, cluster_partition_handling).
+ case application:get_env(rabbit, cluster_partition_handling) of
+ {ok, autoheal} -> true;
+ {ok, {pause_if_all_down, _, autoheal}} -> true;
+ _ -> false
+ end.
%% This is the winner receiving its last notification that a node has
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl
index 6845ada4..fedbfd78 100644
--- a/src/rabbit_node_monitor.erl
+++ b/src/rabbit_node_monitor.erl
@@ -221,7 +221,7 @@ pause_partition_guard() ->
case M of
pause_minority ->
pause_minority_guard([]);
- {pause_if_all_down, PreferredNodes} ->
+ {pause_if_all_down, PreferredNodes, _} ->
case verify_pause_if_all_down_list(PreferredNodes) of
[] -> put(pause_partition_guard, not_pause_mode),
ok;
@@ -562,7 +562,7 @@ handle_dead_node(Node, State = #state{autoheal = Autoheal}) ->
false -> await_cluster_recovery(fun majority/0)
end,
State;
- {ok, {pause_if_all_down, PreferredNodes}} ->
+ {ok, {pause_if_all_down, PreferredNodes, HowToRecover}} ->
case verify_pause_if_all_down_list(PreferredNodes) of
[] -> ok;
Nodes -> case in_preferred_partition(Nodes) of
@@ -571,7 +571,11 @@ handle_dead_node(Node, State = #state{autoheal = Autoheal}) ->
fun in_preferred_partition/0)
end
end,
- State;
+ case HowToRecover of
+ autoheal -> State#state{autoheal =
+ rabbit_autoheal:node_down(Node, Autoheal)};
+ _ -> State
+ end;
{ok, ignore} ->
State;
{ok, autoheal} ->
@@ -747,7 +751,7 @@ majority() ->
length(alive_nodes(Nodes)) / length(Nodes) > 0.5.
in_preferred_partition() ->
- {ok, {pause_if_all_down, PreferredNodes}} =
+ {ok, {pause_if_all_down, PreferredNodes, _}} =
application:get_env(rabbit, cluster_partition_handling),
in_preferred_partition(PreferredNodes).