Skip to content

Commit

Permalink
feat: unregister mnesia_hook upon stopping mria
Browse files Browse the repository at this point in the history
Closes: EMQX-9101
  • Loading branch information
SergeTupchiy committed Mar 22, 2023
1 parent 9e59c4b commit be97073
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mria_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ start(_Type, _Args) ->
mria_sup:start_link().

stop(_State) ->
mria_rlog:cleanup(),
mria_config:erase_all_config(),
?tp(notice, "Mria is stopped", #{}).

Expand Down
9 changes: 9 additions & 0 deletions src/mria_rlog.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
, subscribe/4
, wait_for_shards/2
, init/0
, cleanup/0

, intercept_trans/2
, ensure_shard/1
Expand Down Expand Up @@ -212,3 +213,11 @@ init() ->
_ ->
ok
end.

cleanup() ->
case mria_config:whoami() of
core ->
mnesia_hook:unregister_hook(post_commit);
_ ->
ok
end.

0 comments on commit be97073

Please sign in to comment.