fix(emqx_router_helper): don't cleanup down node on a replicant
The cleanup on a replicant node is redundant, as Mria would delegate this delete op to a core node (via RPC), and the core node is expected to receive the same `nodedown` message and process it.
This commit is contained in:
parent
f276ea9e91
commit
2b7798608d
|
@ -146,13 +146,18 @@ handle_info({mnesia_table_event, Event}, State) ->
|
|||
?SLOG(debug, #{msg => "unexpected_mnesia_table_event", event => Event}),
|
||||
{noreply, State};
|
||||
handle_info({nodedown, Node}, State = #{nodes := Nodes}) ->
|
||||
global:trans(
|
||||
{?LOCK, self()},
|
||||
fun() ->
|
||||
mria:transaction(?ROUTE_SHARD, fun ?MODULE:cleanup_routes/1, [Node])
|
||||
end
|
||||
),
|
||||
ok = mria:dirty_delete(?ROUTING_NODE, Node),
|
||||
case mria_rlog:role() of
|
||||
core ->
|
||||
global:trans(
|
||||
{?LOCK, self()},
|
||||
fun() ->
|
||||
mria:transaction(?ROUTE_SHARD, fun ?MODULE:cleanup_routes/1, [Node])
|
||||
end
|
||||
),
|
||||
ok = mria:dirty_delete(?ROUTING_NODE, Node);
|
||||
replicant ->
|
||||
ok
|
||||
end,
|
||||
?tp(emqx_router_helper_cleanup_done, #{node => Node}),
|
||||
{noreply, State#{nodes := lists:delete(Node, Nodes)}, hibernate};
|
||||
handle_info({membership, {mnesia, down, Node}}, State) ->
|
||||
|
|
Loading…
Reference in New Issue