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 b711293
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 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
11 changes: 9 additions & 2 deletions deps/rabbit/test/per_vhost_connection_limit_partitions_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,15 @@ cluster_full_partition_with_autoheal(Config) ->
rabbit_ct_broker_helpers:allow_traffic_between(B, C),
timer:sleep(?DELAY),

%% during autoheal B's connections were dropped
?awaitMatch(Connections when length(Connections) == 4,
%% During autoheal B's connections were dropped. Autoheal is not running
%% when Khepri is used.
KhepriEnabled = rabbit_ct_broker_helpers:is_feature_flag_enabled(
Config, khepri_db),
ExpectedCount = case KhepriEnabled of
true -> 6;
false ->4
end,
?awaitMatch(Connections when length(Connections) == ExpectedCount,
connections_in(Config, VHost),
60000, 3000),

Expand Down

0 comments on commit b711293

Please sign in to comment.