fix(mria): Replace mnesia calls with mria
This commit is contained in:
parent
0d2d5f6bf9
commit
b3a8753219
|
@ -273,7 +273,7 @@ trans(Fun, Args) ->
|
||||||
{WPid, RefMon} =
|
{WPid, RefMon} =
|
||||||
spawn_monitor(
|
spawn_monitor(
|
||||||
%% NOTE: this is under the assumption that crashes in Fun
|
%% NOTE: this is under the assumption that crashes in Fun
|
||||||
%% are caught by mnesia:transaction/2.
|
%% are caught by mria:transaction/2.
|
||||||
%% Future changes should keep in mind that this process
|
%% Future changes should keep in mind that this process
|
||||||
%% always exit with database write result.
|
%% always exit with database write result.
|
||||||
fun() ->
|
fun() ->
|
||||||
|
|
|
@ -188,6 +188,6 @@ t_delete3(_) ->
|
||||||
clear_tables() -> emqx_trie:clear_tables().
|
clear_tables() -> emqx_trie:clear_tables().
|
||||||
|
|
||||||
trans(Fun) ->
|
trans(Fun) ->
|
||||||
mnesia:transaction(Fun).
|
mria:transaction(?ROUTE_SHARD, Fun).
|
||||||
trans(Fun, Args) ->
|
trans(Fun, Args) ->
|
||||||
mnesia:transaction(Fun, Args).
|
mria:transaction(?ROUTE_SHARD, Fun, Args).
|
||||||
|
|
|
@ -54,19 +54,19 @@ end_per_suite(_Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(t_authz, Config) ->
|
init_per_testcase(t_authz, Config) ->
|
||||||
mnesia:transaction(fun mria:dirty_write/1, [#emqx_acl{who = {?ACL_TABLE_USERNAME, <<"test_username">>},
|
mria:dirty_write(#emqx_acl{who = {?ACL_TABLE_USERNAME, <<"test_username">>},
|
||||||
rules = [{allow, publish, <<"test/%u">>},
|
rules = [{allow, publish, <<"test/%u">>},
|
||||||
{allow, subscribe, <<"eq #">>}
|
{allow, subscribe, <<"eq #">>}
|
||||||
]
|
]
|
||||||
}]),
|
}),
|
||||||
mnesia:transaction(fun mria:dirty_write/1, [#emqx_acl{who = {?ACL_TABLE_CLIENTID, <<"test_clientid">>},
|
mria:dirty_write(#emqx_acl{who = {?ACL_TABLE_CLIENTID, <<"test_clientid">>},
|
||||||
rules = [{allow, publish, <<"test/%c">>},
|
rules = [{allow, publish, <<"test/%c">>},
|
||||||
{deny, subscribe, <<"eq #">>}
|
{deny, subscribe, <<"eq #">>}
|
||||||
]
|
]
|
||||||
}]),
|
}),
|
||||||
mnesia:transaction(fun mria:dirty_write/1, [#emqx_acl{who = ?ACL_TABLE_ALL,
|
mria:dirty_write(#emqx_acl{who = ?ACL_TABLE_ALL,
|
||||||
rules = [{deny, all, <<"#">>}]
|
rules = [{deny, all, <<"#">>}]
|
||||||
}]),
|
}),
|
||||||
Config;
|
Config;
|
||||||
init_per_testcase(_, Config) -> Config.
|
init_per_testcase(_, Config) -> Config.
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ get_telemetry() ->
|
||||||
%% gen_server callbacks
|
%% gen_server callbacks
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
%% This is to suppress dialyzer warnings for mnesia:dirty_write and
|
%% This is to suppress dialyzer warnings for mria:dirty_write and
|
||||||
%% dirty_read race condition. Given that the init function is not evaluated
|
%% dirty_read race condition. Given that the init function is not evaluated
|
||||||
%% concurrently in one node, it should be free of race condition.
|
%% concurrently in one node, it should be free of race condition.
|
||||||
%% Given the chance of having two nodes bootstraping with the write
|
%% Given the chance of having two nodes bootstraping with the write
|
||||||
|
|
Loading…
Reference in New Issue