summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Corbacho <diana@rabbitmq.com>2016-08-24 09:12:50 +0100
committerDiana Corbacho <diana@rabbitmq.com>2016-08-24 09:12:50 +0100
commit484db84679351fd7137aadcd1d9083750490194a (patch)
tree462bebc4c39a6f66155b85fd01d9c34d8aca02b0
parentedf5d7527fcc8aba9707584adbece681e7d10f04 (diff)
downloadrabbitmq-server-git-484db84679351fd7137aadcd1d9083750490194a.tar.gz
Handle late autoheal_finished message
-rw-r--r--src/rabbit_autoheal.erl8
-rw-r--r--test/partitions_SUITE.erl9
2 files changed, 17 insertions, 0 deletions
diff --git a/src/rabbit_autoheal.erl b/src/rabbit_autoheal.erl
index 56551ca885..9d6bfff5fc 100644
--- a/src/rabbit_autoheal.erl
+++ b/src/rabbit_autoheal.erl
@@ -291,6 +291,14 @@ handle_msg({autoheal_finished, Winner}, not_healing, _Partitions)
%% We are the leader and the winner. The state already transitioned
%% to "not_healing" at the end of the autoheal process.
rabbit_log:info("Autoheal finished according to winner ~p~n", [node()]),
+ not_healing;
+
+handle_msg({autoheal_finished, Winner}, not_healing, _Partitions) ->
+ %% We might have seen the winner down during a partial partition and
+ %% transitioned to not_healing. However, the winner was still able
+ %% to finish. Let it pass.
+ rabbit_log:info("Autoheal finished according to winner ~p."
+ " Unexpected, I might have previously seen the winner down~n", [Winner]),
not_healing.
%%----------------------------------------------------------------------------
diff --git a/test/partitions_SUITE.erl b/test/partitions_SUITE.erl
index b99e64b213..aa1c1df24f 100644
--- a/test/partitions_SUITE.erl
+++ b/test/partitions_SUITE.erl
@@ -46,6 +46,7 @@ groups() ->
autoheal,
autoheal_after_pause_if_all_down,
autoheal_multiple_partial_partitions,
+ autoheal_unexpected_finish,
ignore,
pause_if_all_down_on_blocked,
pause_if_all_down_on_down,
@@ -321,6 +322,14 @@ autoheal_multiple_partial_partitions(Config) ->
[await_partitions(N, []) || N <- [A, B, C]],
ok.
+autoheal_unexpected_finish(Config) ->
+ set_mode(Config, autoheal),
+ [A, B, _C] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
+ Pid = rpc:call(A, erlang, whereis, [rabbit_node_monitor]),
+ Pid ! {autoheal_msg, {autoheal_finished, B}},
+ Pid = rpc:call(A, erlang, whereis, [rabbit_node_monitor]),
+ ok.
+
partial_false_positive(Config) ->
[A, B, C] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
block([{A, B}]),