Skip to content

Commit

Permalink
rabbit_node_monitor: Don't run autoheal when using Khepri
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbbell committed Aug 10, 2023
1 parent f755628 commit f85fbdc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions deps/rabbit/src/rabbit_node_monitor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -868,10 +868,16 @@ handle_live_rabbit(Node) ->
on_node_up_using_mnesia(Node) ->
ok = rabbit_mnesia:on_node_up(Node).

maybe_autoheal(State = #state{partitions = []}) ->
maybe_autoheal(State) ->
case rabbit_khepri:use_khepri() of
true -> State;
false -> maybe_autoheal1(State)
end.

maybe_autoheal1(State = #state{partitions = []}) ->
State;

maybe_autoheal(State = #state{autoheal = AState}) ->
maybe_autoheal1(State = #state{autoheal = AState}) ->
case all_nodes_up() of
true -> State#state{autoheal = rabbit_autoheal:maybe_start(AState)};
false -> State
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@ cluster_full_partition_with_autoheal(Config) ->
?awaitMatch(All, list_running(Config, B), 60000, 3000),
?awaitMatch(All, list_running(Config, C), 60000, 3000),

%% during autoheal B's connections were dropped
?awaitMatch({4, 10},
KhepriEnabled = rabbit_ct_broker_helpers:is_feature_flag_enabled(
Config, khepri_db),
ExpectedCount = case KhepriEnabled of
true -> {6, 15};
false -> {4, 10}
end,
%% During autoheal B's connections were dropped. Autoheal is not running
%% when Khepri is used.
?awaitMatch(ExpectedCount,
{count_connections_in(Config, Username),
count_channels_in(Config, Username)},
60000, 3000),
Expand Down

0 comments on commit f85fbdc

Please sign in to comment.