From a1495689c0d890903353ff052f306ee76f133728 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Mon, 8 Apr 2024 10:21:00 +0800 Subject: [PATCH 1/4] fix: clean self node's cluster commit when leave cluster --- apps/emqx_conf/src/emqx_cluster_rpc.erl | 3 ++- changes/ce/fix-12843.en.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changes/ce/fix-12843.en.md diff --git a/apps/emqx_conf/src/emqx_cluster_rpc.erl b/apps/emqx_conf/src/emqx_cluster_rpc.erl index 39d471ed9..37f052f56 100644 --- a/apps/emqx_conf/src/emqx_cluster_rpc.erl +++ b/apps/emqx_conf/src/emqx_cluster_rpc.erl @@ -224,6 +224,7 @@ reset() -> gen_server:call(?MODULE, reset). status() -> transaction(fun ?MODULE:trans_status/0, []). +%% DO NOT delete this on_leave_clean/0, It's use when rpc before v560. on_leave_clean() -> on_leave_clean(node()). @@ -367,7 +368,7 @@ handle_call({fast_forward_to_commit, ToTnxId}, _From, State) -> NodeId = do_fast_forward_to_commit(ToTnxId, State), {reply, NodeId, State, catch_up(State)}; handle_call(on_leave, _From, State) -> - {atomic, ok} = transaction(fun ?MODULE:on_leave_clean/0, []), + {atomic, ok} = transaction(fun ?MODULE:on_leave_clean/1, [node()]), {reply, ok, State#{is_leaving := true}}; handle_call(_, _From, State) -> {reply, ok, State, catch_up(State)}. diff --git a/changes/ce/fix-12843.en.md b/changes/ce/fix-12843.en.md new file mode 100644 index 000000000..f0ba2af8c --- /dev/null +++ b/changes/ce/fix-12843.en.md @@ -0,0 +1,2 @@ +Fixed cluster_rpc_commit tnx_id was not properly cleanup after 'cluster leave' on replicator nodes, +The tnx_id of the core node will be deleted before, resulting in the failure of the core node update configuration. From 5579086220b77b2914c0d7f9844f83df022aa330 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Tue, 9 Apr 2024 14:15:18 +0800 Subject: [PATCH 2/4] chore: replicantor -> replicant --- changes/ce/fix-12843.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/ce/fix-12843.en.md b/changes/ce/fix-12843.en.md index f0ba2af8c..38a46273f 100644 --- a/changes/ce/fix-12843.en.md +++ b/changes/ce/fix-12843.en.md @@ -1,2 +1,2 @@ -Fixed cluster_rpc_commit tnx_id was not properly cleanup after 'cluster leave' on replicator nodes, +Fixed cluster_rpc_commit tnx_id was not properly cleanup after 'cluster leave' on replicant nodes, The tnx_id of the core node will be deleted before, resulting in the failure of the core node update configuration. From 838113291931ae9cc06ea732b70e531340909269 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Tue, 9 Apr 2024 14:44:11 +0800 Subject: [PATCH 3/4] chore: bump emqx_conf to 0.1.36 --- apps/emqx_conf/src/emqx_conf.app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx_conf/src/emqx_conf.app.src b/apps/emqx_conf/src/emqx_conf.app.src index dedb0c3c6..0646bc255 100644 --- a/apps/emqx_conf/src/emqx_conf.app.src +++ b/apps/emqx_conf/src/emqx_conf.app.src @@ -1,6 +1,6 @@ {application, emqx_conf, [ {description, "EMQX configuration management"}, - {vsn, "0.1.35"}, + {vsn, "0.1.36"}, {registered, []}, {mod, {emqx_conf_app, []}}, {applications, [kernel, stdlib]}, From d393e963798a443887ed864d45d1e1efef00c820 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Tue, 9 Apr 2024 16:56:41 +0800 Subject: [PATCH 4/4] chore: Apply suggestions from code review Co-authored-by: ieQu1 <99872536+ieQu1@users.noreply.github.com> --- changes/ce/fix-12843.en.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changes/ce/fix-12843.en.md b/changes/ce/fix-12843.en.md index 38a46273f..000026c00 100644 --- a/changes/ce/fix-12843.en.md +++ b/changes/ce/fix-12843.en.md @@ -1,2 +1,2 @@ -Fixed cluster_rpc_commit tnx_id was not properly cleanup after 'cluster leave' on replicant nodes, -The tnx_id of the core node will be deleted before, resulting in the failure of the core node update configuration. +Fixed `cluster_rpc_commit` transaction ID cleanup procedure after `cluster leave` on replicant nodes. +Previously, the transaction id of the core node would be deleted prematurely, blocking configuration updates on the core node.