From 820789a09f5e6c4832f90e05eb307520e3af28c2 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Mon, 8 Jul 2024 17:32:45 +0800 Subject: [PATCH] fix: redact status when mark_fix_log begin --- apps/emqx_conf/src/emqx_cluster_rpc.erl | 8 ++++---- apps/emqx_conf/src/emqx_conf_cli.erl | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/emqx_conf/src/emqx_cluster_rpc.erl b/apps/emqx_conf/src/emqx_cluster_rpc.erl index 283e17ed7..7f7a44faf 100644 --- a/apps/emqx_conf/src/emqx_cluster_rpc.erl +++ b/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. diff --git a/apps/emqx_conf/src/emqx_conf_cli.erl b/apps/emqx_conf/src/emqx_conf_cli.erl index 864d8e08a..e730f23c0 100644 --- a/apps/emqx_conf/src/emqx_conf_cli.erl +++ b/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) ->