diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-02-26 11:53:49 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-02-26 11:53:49 +0000 |
commit | 49f424ac67dbecd99a7f0f3096f834c5325339cb (patch) | |
tree | 7e15e96a883f1409a32a9aff6b760098b8fe1f41 /src/rabbit_autoheal.erl | |
parent | c1012385819d70b91ceefbf38a940b86f89c128f (diff) | |
download | rabbitmq-server-49f424ac67dbecd99a7f0f3096f834c5325339cb.tar.gz |
If we abandon autoheal while in winner_waiting then let the losing nodes know they can carry on.bug26038
Diffstat (limited to 'src/rabbit_autoheal.erl')
-rw-r--r-- | src/rabbit_autoheal.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit_autoheal.erl b/src/rabbit_autoheal.erl index 43d35fb5..c6b26245 100644 --- a/src/rabbit_autoheal.erl +++ b/src/rabbit_autoheal.erl @@ -77,6 +77,14 @@ enabled() -> node_down(_Node, not_healing) -> not_healing; + +node_down(Node, {winner_waiting, _, Notify}) -> + rabbit_log:info("Autoheal: aborting - ~p went down~n", [Node]), + %% Make sure any nodes waiting for us start - it won't necessarily + %% heal the partition but at least they won't get stuck. + notify_safe(Notify), + not_healing; + node_down(Node, _State) -> rabbit_log:info("Autoheal: aborting - ~p went down~n", [Node]), not_healing. @@ -142,7 +150,7 @@ handle_msg({winner_is, Winner}, handle_msg({node_stopped, Node}, {winner_waiting, [Node], Notify}, _Partitions) -> rabbit_log:info("Autoheal: final node has stopped, starting...~n",[]), - [{rabbit_outside_app_process, N} ! autoheal_safe_to_start || N <- Notify], + notify_safe(Notify), not_healing; handle_msg({node_stopped, Node}, @@ -161,6 +169,9 @@ handle_msg({node_stopped, _Node}, State, _Partitions) -> send(Node, Msg) -> {?SERVER, Node} ! {autoheal_msg, Msg}. +notify_safe(Notify) -> + [{rabbit_outside_app_process, N} ! autoheal_safe_to_start || N <- Notify]. + make_decision(AllPartitions) -> Sorted = lists:sort([{partition_value(P), P} || P <- AllPartitions]), [[Winner | _] | Rest] = lists:reverse([P || {_, P} <- Sorted]), |