From 55179ccfeda75bbf31f9d38fe1a6c47f4f74f5fc Mon Sep 17 00:00:00 2001 From: Serge Tupchii Date: Tue, 9 Apr 2024 19:04:38 +0300 Subject: [PATCH 1/2] chore: update ekka to 0.19.3 Included updates: - https://github.com/emqx/mria/pull/178 --- apps/emqx/rebar.config | 2 +- mix.exs | 2 +- rebar.config | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/emqx/rebar.config b/apps/emqx/rebar.config index 70cf636e7..99b8a21a4 100644 --- a/apps/emqx/rebar.config +++ b/apps/emqx/rebar.config @@ -28,7 +28,7 @@ {gproc, {git, "https://github.com/emqx/gproc", {tag, "0.9.0.1"}}}, {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}}, {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.1"}}}, - {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.2"}}}, + {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.3"}}}, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}}, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.42.1"}}}, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.3"}}}, diff --git a/mix.exs b/mix.exs index 2ebbc7e66..87fd4d62e 100644 --- a/mix.exs +++ b/mix.exs @@ -55,7 +55,7 @@ defmodule EMQXUmbrella.MixProject do {:cowboy, github: "emqx/cowboy", tag: "2.9.2", override: true}, {:esockd, github: "emqx/esockd", tag: "5.11.1", override: true}, {:rocksdb, github: "emqx/erlang-rocksdb", tag: "1.8.0-emqx-2", override: true}, - {:ekka, github: "emqx/ekka", tag: "0.19.2", override: true}, + {:ekka, github: "emqx/ekka", tag: "0.19.3", override: true}, {:gen_rpc, github: "emqx/gen_rpc", tag: "3.3.1", override: true}, {:grpc, github: "emqx/grpc-erl", tag: "0.6.12", override: true}, {:minirest, github: "emqx/minirest", tag: "1.4.0", override: true}, diff --git a/rebar.config b/rebar.config index 537707f4a..b5f5f1d9a 100644 --- a/rebar.config +++ b/rebar.config @@ -83,7 +83,7 @@ {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}}, {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.1"}}}, {rocksdb, {git, "https://github.com/emqx/erlang-rocksdb", {tag, "1.8.0-emqx-2"}}}, - {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.2"}}}, + {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.3"}}}, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}}, {grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.12"}}}, {minirest, {git, "https://github.com/emqx/minirest", {tag, "1.4.0"}}}, From fae9005f87d9b4925d8a3a19328e2fb368793f29 Mon Sep 17 00:00:00 2001 From: Serge Tupchii Date: Tue, 9 Apr 2024 19:06:13 +0300 Subject: [PATCH 2/2] test(emqx_mgmt_cli): test that replicants do not join a left core node --- .../test/emqx_mgmt_cli_SUITE.erl | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/emqx_management/test/emqx_mgmt_cli_SUITE.erl b/apps/emqx_management/test/emqx_mgmt_cli_SUITE.erl index c6f00bff0..b1d646b40 100644 --- a/apps/emqx_management/test/emqx_mgmt_cli_SUITE.erl +++ b/apps/emqx_management/test/emqx_mgmt_cli_SUITE.erl @@ -33,12 +33,12 @@ end_per_suite(_) -> emqx_mgmt_api_test_util:end_suite([emqx_management, emqx_conf]). init_per_testcase(t_autocluster_leave = TC, Config) -> - [Core1, Core2, Core3, Repl] = + [Core1, Core2, Repl1, Repl2] = Nodes = [ t_autocluster_leave_core1, t_autocluster_leave_core2, - t_autocluster_leave_core3, - t_autocluster_leave_replicant + t_autocluster_leave_replicant1, + t_autocluster_leave_replicant2 ], NodeNames = [emqx_cth_cluster:node_name(N) || N <- Nodes], @@ -58,8 +58,8 @@ init_per_testcase(t_autocluster_leave = TC, Config) -> [ {Core1, #{role => core, apps => AppSpec}}, {Core2, #{role => core, apps => AppSpec}}, - {Core3, #{role => core, apps => AppSpec}}, - {Repl, #{role => replicant, apps => AppSpec}} + {Repl1, #{role => replicant, apps => AppSpec}}, + {Repl2, #{role => replicant, apps => AppSpec}} ], #{work_dir => emqx_cth_suite:work_dir(TC, Config)} ), @@ -307,7 +307,7 @@ t_admin(_Config) -> ok. t_autocluster_leave(Config) -> - [Core1, Core2, Core3, Repl] = Cluster = ?config(cluster, Config), + [Core1, Core2, Repl1, Repl2] = Cluster = ?config(cluster, Config), %% Mria membership updates are async, makes sense to wait a little timer:sleep(300), ClusterView = [lists:sort(rpc:call(N, emqx, running_nodes, [])) || N <- Cluster], @@ -317,24 +317,24 @@ t_autocluster_leave(Config) -> ?assertEqual(View1, View3), ?assertEqual(View1, View4), - rpc:call(Core3, emqx_mgmt_cli, cluster, [["leave"]]), + rpc:call(Core2, emqx_mgmt_cli, cluster, [["leave"]]), timer:sleep(1000), - %% Replicant node may still discover and join Core3 which is now split from [Core1, Core2], - %% but it's expected to choose a bigger cluster of [Core1, Core2].. - ?assertMatch([Core3], rpc:call(Core3, emqx, running_nodes, [])), + %% Replicant nodes can discover Core2 which is now split from [Core1, Core2], + %% but they are expected to ignore Core2, + %% since mria_lb must filter out core nodes that disabled discovery. + ?assertMatch([Core2], rpc:call(Core2, emqx, running_nodes, [])), ?assertEqual(undefined, rpc:call(Core1, erlang, whereis, [ekka_autocluster])), - ?assertEqual(lists:sort([Core1, Core2, Repl]), rpc:call(Core1, emqx, running_nodes, [])), - ?assertEqual(lists:sort([Core1, Core2, Repl]), rpc:call(Core2, emqx, running_nodes, [])), - ?assertEqual(lists:sort([Core1, Core2, Repl]), rpc:call(Repl, emqx, running_nodes, [])), + ?assertEqual(lists:sort([Core1, Repl1, Repl2]), rpc:call(Core1, emqx, running_nodes, [])), + ?assertEqual(lists:sort([Core1, Repl1, Repl2]), rpc:call(Repl1, emqx, running_nodes, [])), + ?assertEqual(lists:sort([Core1, Repl1, Repl2]), rpc:call(Repl2, emqx, running_nodes, [])), - rpc:call(Repl, emqx_mgmt_cli, cluster, [["leave"]]), + rpc:call(Repl1, emqx_mgmt_cli, cluster, [["leave"]]), timer:sleep(1000), - ?assertEqual(lists:sort([Core1, Core2]), rpc:call(Core1, emqx, running_nodes, [])), - ?assertEqual(lists:sort([Core1, Core2]), rpc:call(Core2, emqx, running_nodes, [])), + ?assertEqual(lists:sort([Core1, Repl2]), rpc:call(Core1, emqx, running_nodes, [])), - rpc:call(Core3, emqx_mgmt_cli, cluster, [["discovery", "enable"]]), - rpc:call(Repl, emqx_mgmt_cli, cluster, [["discovery", "enable"]]), - %% core nodes will join and restart asyncly, may need more time to re-cluster + rpc:call(Core2, emqx_mgmt_cli, cluster, [["discovery", "enable"]]), + rpc:call(Repl1, emqx_mgmt_cli, cluster, [["discovery", "enable"]]), + %% nodes will join and restart asyncly, may need more time to re-cluster ?assertEqual( ok, emqx_common_test_helpers:wait_for(