瀏覽代碼

fix(mria): Hook up mria to emqx_machine

k32 4 年之前
父節點
當前提交
73a4816d9c

+ 1 - 1
apps/emqx_machine/src/emqx_cluster_rpc.erl

@@ -87,7 +87,7 @@ multicall(M, F, A, RequireNum, Timeout) when RequireNum =:= all orelse RequireNu
                 %% the initiate transaction must happened on core node
                 %% make sure MFA(in the transaction) and the transaction on the same node
                 %% don't need rpc again inside transaction.
-                case ekka_rlog_status:upstream_node(?EMQX_MACHINE_SHARD) of
+                case mria_status:upstream_node(?EMQX_MACHINE_SHARD) of
                     {ok, Node} -> gen_server:call({?MODULE, Node}, MFA, Timeout);
                     disconnected -> {error, disconnected}
                 end

+ 1 - 0
apps/emqx_machine/src/emqx_machine.erl

@@ -35,6 +35,7 @@ start() ->
     ok = set_backtrace_depth(),
     ok = print_otp_version_warning(),
     ok = load_config_files(),
+    mria:start(),
     ekka:start(),
     mria_rlog:wait_for_shards([?EMQX_MACHINE_SHARD], infinity),
     ok.

+ 3 - 3
apps/emqx_machine/src/emqx_machine_schema.erl

@@ -139,7 +139,7 @@ fields("cluster") ->
           #{})}
     , {"db_backend",
         sc(hoconsc:enum([mnesia, rlog]),
-          #{ mapping => "ekka.db_backend"
+          #{ mapping => "mria.db_backend"
            , default => mnesia
            })}
     , {"rlog",
@@ -245,12 +245,12 @@ fields(cluster_k8s) ->
 fields("rlog") ->
     [ {"role",
        sc(hoconsc:enum([core, replicant]),
-          #{ mapping => "ekka.node_role"
+          #{ mapping => "mria.node_role"
            , default => core
            })}
     , {"core_nodes",
        sc(emqx_schema:comma_separated_atoms(),
-          #{ mapping => "ekka.core_nodes"
+          #{ mapping => "mria.core_nodes"
            , default => []
            })}
     ];

+ 1 - 1
apps/emqx_prometheus/src/emqx_prometheus.erl

@@ -590,6 +590,6 @@ emqx_cluster() ->
     ].
 
 emqx_cluster_data() ->
-    #{running_nodes := Running, stopped_nodes := Stopped} = mria:cluster_info(),
+    #{running_nodes := Running, stopped_nodes := Stopped} = mria_mnesia:cluster_info(),
     [{nodes_running, length(Running)},
      {nodes_stopped, length(Stopped)}].

+ 1 - 1
rebar.config.erl

@@ -60,7 +60,7 @@ community_plugin_overrides() ->
 %% Temporary workaround for a rebar3 erl_opts duplication
 %% bug. Ideally, we want to set this define globally
 snabbkaffe_overrides() ->
-    Apps = [snabbkaffe, ekka],
+    Apps = [snabbkaffe, ekka, mria],
     [{add, App, [{erl_opts, [{d, snk_kind, msg}]}]} || App <- Apps].
 
 config(HasElixir) ->