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 | f47e34edf544655fea45b1c6a92919437d69a3d2 (patch) | |
| tree | 7e15e96a883f1409a32a9aff6b760098b8fe1f41 | |
| parent | 949aedbf489a8c700040d243bd9776f50e52288b (diff) | |
| download | rabbitmq-server-git-f47e34edf544655fea45b1c6a92919437d69a3d2.tar.gz | |
If we abandon autoheal while in winner_waiting then let the losing nodes know they can carry on.
| -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 43d35fb5e4..c6b26245af 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]), |
