Skip to content

Commit

Permalink
Handle late autoheal_finished message
Browse files Browse the repository at this point in the history
  • Loading branch information
dcorbacho committed Aug 24, 2016
1 parent edf5d75 commit 484db84
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/rabbit_autoheal.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

%%----------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions test/partitions_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}]),
Expand Down

0 comments on commit 484db84

Please sign in to comment.