Skip to content

Commit 9092de1

Browse files
kjnilssongerhard
authored andcommitted
Stream coordinator: only return tail info if osiris app is started
This ensures that only nodes that are ready to host stream members are included in the election. This avoids continuous restart attempts when the rabbit application is stopped.
1 parent 6c0ba03 commit 9092de1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

deps/rabbit/src/rabbit_stream_coordinator.erl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,8 @@ get_replica_tail(Node, Conf) ->
782782
case rpc:call(Node, ?MODULE, log_overview, [Conf]) of
783783
{badrpc, nodedown} ->
784784
{error, nodedown};
785+
{error, _} = Err ->
786+
Err;
785787
{_Range, Offsets} ->
786788
{ok, select_highest_offset(Offsets)}
787789
end.
@@ -792,8 +794,13 @@ select_highest_offset(Offsets) ->
792794
lists:last(Offsets).
793795

794796
log_overview(Config) ->
795-
Dir = osiris_log:directory(Config),
796-
osiris_log:overview(Dir).
797+
case whereis(osiris_sup) of
798+
undefined ->
799+
{error, app_not_running};
800+
_ ->
801+
Dir = osiris_log:directory(Config),
802+
osiris_log:overview(Dir)
803+
end.
797804

798805

799806
replay(L) when is_list(L) ->

0 commit comments

Comments
 (0)