From 4d876f2af2be63d1b958aaa1cd1a4f3df0df0f2b Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 13 Jun 2024 16:35:58 -0300 Subject: [PATCH 1/5] chore: bump ekka -> 0.19.4 https://github.com/emqx/ekka/pull/236 --- 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 27648a88d..98a2d36fa 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.2"}}}, - {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.3"}}}, + {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.4"}}}, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}}, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.42.2"}}}, {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 b31164e65..d21bae2e7 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.2", override: true}, {:rocksdb, github: "emqx/erlang-rocksdb", tag: "1.8.0-emqx-5", override: true}, - {:ekka, github: "emqx/ekka", tag: "0.19.3", override: true}, + {:ekka, github: "emqx/ekka", tag: "0.19.4", 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.1", override: true}, diff --git a/rebar.config b/rebar.config index be47f8e4d..ce11e5993 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.2"}}}, {rocksdb, {git, "https://github.com/emqx/erlang-rocksdb", {tag, "1.8.0-emqx-5"}}}, - {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.3"}}}, + {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.4"}}}, {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.1"}}}, From cba5c7bb45850eb6edeaf5fe185706b18edca038 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 13 Jun 2024 16:57:34 -0300 Subject: [PATCH 2/5] refactor: rm dead code --- apps/emqx/src/emqx_schema.erl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index 6c8466aab..f08db87c2 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -1952,10 +1952,6 @@ zones_field_schema() -> } ). -desc("persistent_session_store") -> - "Settings for message persistence."; -desc("persistent_session_builtin") -> - "Settings for the built-in storage engine of persistent messages."; desc("persistent_table_mria_opts") -> "Tuning options for the mria table."; desc("stats") -> From 52e6c88941c6899f40b1b1080199a10d62524bf3 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 13 Jun 2024 16:57:46 -0300 Subject: [PATCH 3/5] feat: enforce singleton discovery strategy when using DS `builtin_local` backend Fixes https://emqx.atlassian.net/browse/EMQX-12493 --- apps/emqx_conf/src/emqx_conf_schema.erl | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index 2c0de10aa..dc85cbf3c 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -134,10 +134,27 @@ roots() -> lists:flatmap(fun roots/1, common_apps()). validations() -> - [{check_node_name_and_discovery_strategy, fun validate_cluster_strategy/1}] ++ + [ + {check_node_name_and_discovery_strategy, fun validate_cluster_strategy/1}, + {validate_durable_sessions_strategy, fun validate_durable_sessions_strategy/1} + ] ++ hocon_schema:validations(emqx_schema) ++ lists:flatmap(fun hocon_schema:validations/1, common_apps()). +validate_durable_sessions_strategy(Conf) -> + DSEnabled = hocon_maps:get("durable_sessions.enable", Conf), + DiscoveryStrategy = hocon_maps:get("cluster.discovery_strategy", Conf), + DSBackend = hocon_maps:get("durable_storage.messages.backend", Conf), + case {DSEnabled, DSBackend} of + {true, builtin_local} when DiscoveryStrategy =/= singleton -> + {error, << + "cluster discovery strategy must be 'singleton' when" + " durable storage backend is builtin_local" + >>}; + _ -> + ok + end. + common_apps() -> Edition = emqx_release:edition(), lists:filtermap( @@ -166,7 +183,7 @@ fields("cluster") -> )}, {"discovery_strategy", sc( - hoconsc:enum([manual, static, dns, etcd, k8s]), + hoconsc:enum([manual, static, singleton, dns, etcd, k8s]), #{ default => manual, desc => ?DESC(cluster_discovery_strategy), From 01635722e992ec024afa1914a785b83e8e38188d Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 13 Jun 2024 18:34:44 -0300 Subject: [PATCH 4/5] docs: improve descriptions Co-authored-by: ieQu1 <99872536+ieQu1@users.noreply.github.com> --- apps/emqx_conf/src/emqx_conf_schema.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index dc85cbf3c..e3e888cd6 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -149,7 +149,7 @@ validate_durable_sessions_strategy(Conf) -> {true, builtin_local} when DiscoveryStrategy =/= singleton -> {error, << "cluster discovery strategy must be 'singleton' when" - " durable storage backend is builtin_local" + " durable storage backend is 'builtin_local'" >>}; _ -> ok From 378a16b4fb7aee9432a53431b4d146f29c2cbc83 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 13 Jun 2024 16:57:46 -0300 Subject: [PATCH 5/5] feat: enforce singleton discovery strategy when using DS `builtin_local` backend Fixes https://emqx.atlassian.net/browse/EMQX-12493 --- changes/ce/feat-13250.en.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/ce/feat-13250.en.md diff --git a/changes/ce/feat-13250.en.md b/changes/ce/feat-13250.en.md new file mode 100644 index 000000000..9b42ad579 --- /dev/null +++ b/changes/ce/feat-13250.en.md @@ -0,0 +1 @@ +Added a new `cluster.discovery_strategy` value: `singleton`. By choosing this option, there will be effectively no clustering, and the node will reject connection attempts to and from other nodes.