Skip to content

Commit 0f4d90a

Browse files
committed
Use only tick to refresh SAC coordinator configuration
Do not use RA init at all.
1 parent 88ae8e9 commit 0f4d90a

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

deps/rabbit/src/rabbit_stream_coordinator.erl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,9 @@ version() -> 5.
536536
which_module(_) ->
537537
?MODULE.
538538

539-
init(#{machine_version := MacVersion} = Conf) when MacVersion >= 5 ->
540-
SacConf = maps:get(sac_conf, Conf, #{}),
539+
init(#{machine_version := MacVersion}) when MacVersion >= 5 ->
541540
#?MODULE{single_active_consumer =
542-
rabbit_stream_sac_coordinator:init_state(SacConf)};
541+
rabbit_stream_sac_coordinator:init_state()};
543542
init(_) ->
544543
#?MODULE{single_active_consumer = rabbit_stream_sac_coordinator_v4:init_state()}.
545544

@@ -1364,15 +1363,10 @@ make_ra_conf(Node, Nodes, MinMacVersion) ->
13641363
initial_members => Members,
13651364
log_init_args => #{uid => UId},
13661365
tick_timeout => TickTimeout,
1367-
machine => {module, ?MODULE, #{sac_conf => make_sac_conf(MinMacVersion)}},
1366+
machine => {module, ?MODULE, #{}},
13681367
initial_machine_version => MinMacVersion,
13691368
ra_event_formatter => Formatter}.
13701369

1371-
make_sac_conf(MinMacVersion) when MinMacVersion >= 5 ->
1372-
sac_make_conf();
1373-
make_sac_conf(_) ->
1374-
#{}.
1375-
13761370
filter_command(_Meta, {delete_replica, _, #{node := Node}}, #stream{id = StreamId,
13771371
members = Members0}) ->
13781372
Members = maps:filter(fun(_, #member{target = S}) when S =/= deleted ->
@@ -2450,9 +2444,6 @@ maps_to_list(M) ->
24502444
ra_local_query(QueryFun) ->
24512445
ra:local_query({?MODULE, node()}, QueryFun, infinity).
24522446

2453-
sac_make_conf() ->
2454-
rabbit_stream_sac_coordinator:make_conf().
2455-
24562447
sac_make_purge_nodes(Nodes) ->
24572448
rabbit_stream_sac_coordinator:make_purge_nodes(Nodes).
24582449

deps/rabbit/src/rabbit_stream_sac_coordinator.erl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
group_consumers/4,
3939
connection_reconnected/1]).
4040
-export([apply/2,
41-
init_state/1,
41+
init_state/0,
4242
send_message/2,
4343
ensure_monitors/4,
4444
handle_connection_down/2,
@@ -49,7 +49,6 @@
4949
group_consumers/5,
5050
overview/1,
5151
import_state/2,
52-
make_conf/0,
5352
check_conf_change/1]).
5453
-export([make_purge_nodes/1,
5554
make_update_conf/1]).
@@ -201,10 +200,9 @@ overview(#?MODULE{groups = Groups}) ->
201200
Groups),
202201
#{num_groups => map_size(Groups), groups => GroupsOverview}.
203202

204-
-spec init_state(map()) -> state().
205-
init_state(Conf) ->
206-
DisconTimeout = maps:get(?DISCONNECTED_TIMEOUT_CONF_KEY, Conf,
207-
?DISCONNECTED_TIMEOUT_MS),
203+
-spec init_state() -> state().
204+
init_state() ->
205+
DisconTimeout = ?DISCONNECTED_TIMEOUT_MS,
208206
#?MODULE{groups = #{}, pids_groups = #{},
209207
conf = #{?DISCONNECTED_TIMEOUT_CONF_KEY => DisconTimeout}}.
210208

@@ -863,10 +861,6 @@ import_state(4, #{<<"groups">> := Groups, <<"pids_groups">> := PidsGroups}) ->
863861
pids_groups = map_to_pids_groups(PidsGroups),
864862
conf = #{disconnected_timeout => ?DISCONNECTED_TIMEOUT_MS}}.
865863

866-
-spec make_conf() -> conf().
867-
make_conf() ->
868-
#{?DISCONNECTED_TIMEOUT_CONF_KEY => lookup_disconnected_timeout()}.
869-
870864
-spec check_conf_change(state()) -> {new, conf()} | unchanged.
871865
check_conf_change(#?MODULE{conf = Conf}) ->
872866
DisconTimeout = lookup_disconnected_timeout(),

0 commit comments

Comments
 (0)