Skip to content

Inform queue leaders of cluster node status changes #356

Open
@SimonUnge

Description

@SimonUnge

Add a new optional callback, or similar, that gets called when a node joins or leaves the Erlang cluster.
The callback can take decisions on what to do with this information, such as adding or removing the node
as one of its members.

Suggestion:
Update ra_server_proc:leader state, that already handles nodeup/nodedown, to call a new optional callback.
To cause a randomized delay, perhaps add a erlang:send_after with a new info message, something like
(erlang:send_after(SOMERANDOMNUMBER, self(), {delayed_node_status_update, Node, Status}))

and a new clause to leader, something like

leader(info, {delayed_node_status_update, Node, Status}, State0) ->
    Effects = ra_server:NEW_OPT_CALLBACK(State0#state.server_state, Node, Status),
    {State, Actions} = ?HANDLE_EFFECTS(Effects,
                                        cast, State0),
    {keep_state, State, Actions};

Would perhaps also be good to send along the members of the raft, so that the user code does not have to call ra:members()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions