Просмотр исходного кода

fix(mria): Replace mnesia calls with mria

k32 4 лет назад
Родитель
Сommit
b3a8753219

+ 1 - 1
apps/emqx/src/emqx_router.erl

@@ -273,7 +273,7 @@ trans(Fun, Args) ->
     {WPid, RefMon} =
         spawn_monitor(
             %% 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
             %% always exit with database write result.
             fun() ->

+ 2 - 2
apps/emqx/test/emqx_trie_SUITE.erl

@@ -188,6 +188,6 @@ t_delete3(_) ->
 clear_tables() -> emqx_trie:clear_tables().
 
 trans(Fun) ->
-    mnesia:transaction(Fun).
+    mria:transaction(?ROUTE_SHARD, Fun).
 trans(Fun, Args) ->
-    mnesia:transaction(Fun, Args).
+    mria:transaction(?ROUTE_SHARD, Fun, Args).

+ 13 - 13
apps/emqx_authz/test/emqx_authz_mnesia_SUITE.erl

@@ -54,19 +54,19 @@ end_per_suite(_Config) ->
     ok.
 
 init_per_testcase(t_authz, Config) ->
-    mnesia:transaction(fun mria:dirty_write/1, [#emqx_acl{who = {?ACL_TABLE_USERNAME, <<"test_username">>},
-                                                          rules = [{allow, publish, <<"test/%u">>},
-                                                                   {allow, subscribe, <<"eq #">>}
-                                                                  ]
-                                                     }]),
-    mnesia:transaction(fun mria:dirty_write/1, [#emqx_acl{who = {?ACL_TABLE_CLIENTID, <<"test_clientid">>},
-                                                          rules = [{allow, publish, <<"test/%c">>},
-                                                                   {deny, subscribe, <<"eq #">>}
-                                                                  ]
-                                                         }]),
-    mnesia:transaction(fun mria:dirty_write/1, [#emqx_acl{who = ?ACL_TABLE_ALL,
-                                                          rules = [{deny, all, <<"#">>}]
-                                                         }]),
+    mria:dirty_write(#emqx_acl{who = {?ACL_TABLE_USERNAME, <<"test_username">>},
+                               rules = [{allow, publish, <<"test/%u">>},
+                                        {allow, subscribe, <<"eq #">>}
+                                       ]
+                              }),
+    mria:dirty_write(#emqx_acl{who = {?ACL_TABLE_CLIENTID, <<"test_clientid">>},
+                               rules = [{allow, publish, <<"test/%c">>},
+                                        {deny, subscribe, <<"eq #">>}
+                                       ]
+                              }),
+    mria:dirty_write(#emqx_acl{who = ?ACL_TABLE_ALL,
+                               rules = [{deny, all, <<"#">>}]
+                              }),
     Config;
 init_per_testcase(_, Config) -> Config.
 

+ 1 - 1
apps/emqx_modules/src/emqx_telemetry.erl

@@ -127,7 +127,7 @@ get_telemetry() ->
 %% 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
 %% concurrently in one node, it should be free of race condition.
 %% Given the chance of having two nodes bootstraping with the write