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

fix: redact status when mark_fix_log begin

zhongwencool 1 год назад
Родитель
Сommit
820789a09f
2 измененных файлов с 9 добавлено и 5 удалено
  1. 4 4
      apps/emqx_conf/src/emqx_cluster_rpc.erl
  2. 5 1
      apps/emqx_conf/src/emqx_conf_cli.erl

+ 4 - 4
apps/emqx_conf/src/emqx_cluster_rpc.erl

@@ -43,7 +43,7 @@
     get_cluster_tnx_id/0,
     get_node_tnx_id/1,
     init_mfa/2,
-    update_mfa_in_trans/3,
+    force_sync_tnx_id/3,
     latest_tnx_id/0,
     make_initiate_call_req/3,
     read_next_mfa/1,
@@ -548,7 +548,7 @@ init_mfa(Node, MFA) ->
             {retry, Meta}
     end.
 
-update_mfa_in_trans(Node, MFA, NodeTnxId) ->
+force_sync_tnx_id(Node, MFA, NodeTnxId) ->
     mnesia:write_lock_table(?CLUSTER_MFA),
     case get_node_tnx_id(Node) of
         NodeTnxId ->
@@ -567,13 +567,13 @@ update_mfa_in_trans(Node, MFA, NodeTnxId) ->
                 mria:running_nodes()
             );
         NewTnxId ->
-            Fmt = "someone_has_already_updated,tnx_id(~w) is not the latest(~w)",
+            Fmt = "aborted_force_sync, tnx_id(~w) is not the latest(~w)",
             Reason = emqx_utils:format(Fmt, [NodeTnxId, NewTnxId]),
             mnesia:abort({error, Reason})
     end.
 
 update_mfa(Node, MFA, LatestId) ->
-    case transaction(fun ?MODULE:update_mfa_in_trans/3, [Node, MFA, LatestId]) of
+    case transaction(fun ?MODULE:force_sync_tnx_id/3, [Node, MFA, LatestId]) of
         {atomic, ok} -> ok;
         {aborted, Error} -> Error
     end.

+ 5 - 1
apps/emqx_conf/src/emqx_conf_cli.erl

@@ -155,7 +155,11 @@ mark_fix_begin(Node, TnxId) ->
     emqx_cluster_rpc:update_mfa(Node, MFA, TnxId).
 
 mark_fix_log(Status, Opts) ->
-    ?SLOG(warning, #{msg => cluster_fix_log, status => Status, opts => Opts}),
+    ?SLOG(warning, #{
+        msg => cluster_config_sync_triggered,
+        status => emqx_utils:redact(Status),
+        opts => Opts
+    }),
     ok.
 
 audit(Level, From, Log) ->