Skip to content

Commit

Permalink
Merge branch 'dgud/mnesia/discard-old-info/OTP-19501' into maint
Browse files Browse the repository at this point in the history
* dgud/mnesia/discard-old-info/OTP-19501:
  mnesia: Discard old irrelevant msgs
  • Loading branch information
dgud committed Feb 26, 2025
2 parents 7d04612 + ec9a108 commit 2bc5510
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions lib/mnesia/src/mnesia_controller.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1490,17 +1490,25 @@ orphan_tables([Tab | Tabs], Node, Ns, Local, Remote) ->
orphan_tables([], _, _, LocalOrphans, RemoteMasters) ->
{LocalOrphans, RemoteMasters}.

node_has_tabs([Tab | Tabs], Node, State) when Node /= node() ->
State2 =
try update_whereabouts(Tab, Node, State) of
State1 = #state{} -> State1
catch exit:R -> %% Tab was just deleted?
case ?catch_val({Tab, cstruct}) of
{'EXIT', _} -> State; % yes
_ -> erlang:error(R)
end
end,
node_has_tabs(Tabs, Node, State2);
node_has_tabs([Tab | Tabs], Node, State0) when Node /= node() ->
State = try
case ?catch_val({Tab, cstruct}) of
{'EXIT', _} -> State0;
Cs ->
case mnesia_lib:cs_to_storage_type(Node, Cs) of
unknown -> %% handle_early_msgs may come with obsolete
State0; %% information, if irrelevant ignore it.
_ ->
#state{} = update_whereabouts(Tab, Node, State0)
end
end
catch exit:R:ST -> %% Tab was just deleted?
case ?catch_val({Tab, cstruct}) of
{'EXIT', _} -> State0; % yes
_ -> erlang:error({R, ST})
end
end,
node_has_tabs(Tabs, Node, State);
node_has_tabs([Tab | Tabs], Node, State) ->
user_sync_tab(Tab),
node_has_tabs(Tabs, Node, State);
Expand Down

0 comments on commit 2bc5510

Please sign in to comment.