test: fix cluster_rpc test failed

This commit is contained in:
zhongwencool 2024-06-10 22:19:55 +08:00
parent 2069910ad1
commit 3ed4340145
3 changed files with 11 additions and 8 deletions

View File

@ -104,7 +104,8 @@ admins(["fix"]) ->
AllConfs = find_running_confs(),
case find_inconsistent(Status, AllConfs) of
{inconsistent_tnx_id_key, Target, InconsistentKeys} ->
fix_inconsistent_with_raw(Target, InconsistentKeys);
_ = fix_inconsistent_with_raw(Target, InconsistentKeys),
ok;
inconsistent_tnx_id ->
print_tnx_id_status(Status),
ok = emqx_cluster_rpc:reset(),

View File

@ -142,13 +142,14 @@ t_commit_ok_but_apply_fail_on_other_node(_Config) ->
Res2 = gen_server:call(?NODE3, Call),
%% Node2 is retry on tnx_id 1, and should not run Next MFA.
?assertMatch(
{init_failure, #{
{init_failure,
{error, #{
msg := stale_view_of_cluster_state,
retry_times := 2,
cluster_tnx_id := 2,
node_tnx_id := 1,
suggested := _
}},
}}},
Res1
),
?assertEqual(Res1, Res2),

View File

@ -0,0 +1 @@
Introduce `emqx_cli conf cluster_sync fix` to address cluster inconsistencies. It synchronizes the configuration of the node with the largest `tnx_id` to all nodes.