diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index df906911e..8bab4e777 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -194,18 +194,6 @@ fields("cluster") -> 'readOnly' => true } )}, - {"core_nodes", - sc( - node_array(), - #{ - %% This config is nerver needed (since 5.0.0) - importance => ?IMPORTANCE_HIDDEN, - mapping => "mria.core_nodes", - default => [], - 'readOnly' => true, - desc => ?DESC(db_core_nodes) - } - )}, {"autoclean", sc( emqx_schema:duration(), @@ -600,7 +588,7 @@ fields("node") -> )}, {"role", sc( - hoconsc:enum([core, replicant]), + hoconsc:enum([core] ++ emqx_schema_hooks:injection_point('node.role')), #{ mapping => "mria.node_role", default => core, diff --git a/apps/emqx_conf/src/emqx_conf_schema_inject.erl b/apps/emqx_conf/src/emqx_conf_schema_inject.erl index fb4fee4c7..5ffd3a5af 100644 --- a/apps/emqx_conf/src/emqx_conf_schema_inject.erl +++ b/apps/emqx_conf/src/emqx_conf_schema_inject.erl @@ -22,12 +22,18 @@ schemas() -> schemas(emqx_release:edition()). schemas(Edition) -> - auth_ext(Edition) ++ + mria(Edition) ++ + auth_ext(Edition) ++ cluster_linking(Edition) ++ authn(Edition) ++ authz() ++ customized(Edition). +mria(ce) -> + []; +mria(ee) -> + [emqx_enterprise_schema]. + auth_ext(ce) -> []; auth_ext(ee) -> diff --git a/apps/emqx_conf/test/emqx_conf_schema_tests.erl b/apps/emqx_conf/test/emqx_conf_schema_tests.erl index 72834f6d2..2bb56e5cc 100644 --- a/apps/emqx_conf/test/emqx_conf_schema_tests.erl +++ b/apps/emqx_conf/test/emqx_conf_schema_tests.erl @@ -32,7 +32,6 @@ name = emqxcl discovery_strategy = static static.seeds = ~p - core_nodes = ~p } "). @@ -41,7 +40,7 @@ array_nodes_test() -> ExpectNodes = ['emqx1@127.0.0.1', 'emqx2@127.0.0.1'], lists:foreach( fun(Nodes) -> - ConfFile = to_bin(?BASE_CONF, [Nodes, Nodes]), + ConfFile = to_bin(?BASE_CONF, [Nodes]), {ok, Conf} = hocon:binary(ConfFile, #{format => richmap}), ConfList = hocon_tconf:generate(emqx_conf_schema, Conf), VMArgs = proplists:get_value(vm_args, ConfList), @@ -57,11 +56,6 @@ array_nodes_test() -> {static, [{seeds, ExpectNodes}]}, ClusterDiscovery, Nodes - ), - ?assertEqual( - ExpectNodes, - proplists:get_value(core_nodes, proplists:get_value(mria, ConfList)), - Nodes ) end, [["emqx1@127.0.0.1", "emqx2@127.0.0.1"], "emqx1@127.0.0.1, emqx2@127.0.0.1"] @@ -158,7 +152,7 @@ outdated_log_test() -> validate_log(Conf) -> ensure_acl_conf(), - BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]), + BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]), Conf0 = <>, {ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}), ConfList = hocon_tconf:generate(emqx_conf_schema, ConfMap0), @@ -214,7 +208,7 @@ validate_log(Conf) -> file_log_infinity_rotation_size_test_() -> ensure_acl_conf(), - BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]), + BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]), Gen = fun(#{count := Count, size := Size}) -> Conf0 = to_bin(?FILE_LOG_BASE_CONF, [Count, Size]), Conf1 = [BaseConf, Conf0], @@ -292,7 +286,7 @@ log_rotation_count_limit_test() -> rotation_size = \"1024MB\" } ", - BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]), + BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]), lists:foreach(fun({Conf, Count}) -> Conf0 = <>, {ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}), @@ -352,7 +346,7 @@ log_rotation_count_limit_test() -> authn_validations_test() -> ensure_acl_conf(), - BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]), + BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]), OKHttps = to_bin(?BASE_AUTHN_ARRAY, [post, true, <<"https://127.0.0.1:8080">>]), Conf0 = <>, @@ -410,7 +404,7 @@ authn_validations_test() -> listeners_test() -> ensure_acl_conf(), - BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]), + BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]), Conf = <>, {ok, ConfMap0} = hocon:binary(Conf, #{format => richmap}), diff --git a/apps/emqx_enterprise/src/emqx_enterprise.app.src b/apps/emqx_enterprise/src/emqx_enterprise.app.src index 93fb02287..e79a6f3a3 100644 --- a/apps/emqx_enterprise/src/emqx_enterprise.app.src +++ b/apps/emqx_enterprise/src/emqx_enterprise.app.src @@ -1,6 +1,6 @@ {application, emqx_enterprise, [ {description, "EMQX Enterprise Edition"}, - {vsn, "0.2.2"}, + {vsn, "0.2.3"}, {registered, []}, {applications, [ kernel, diff --git a/apps/emqx_enterprise/src/emqx_enterprise_schema.erl b/apps/emqx_enterprise/src/emqx_enterprise_schema.erl index f593dc877..571757c75 100644 --- a/apps/emqx_enterprise/src/emqx_enterprise_schema.erl +++ b/apps/emqx_enterprise/src/emqx_enterprise_schema.erl @@ -5,12 +5,14 @@ -module(emqx_enterprise_schema). -behaviour(hocon_schema). +-behaviour(emqx_schema_hooks). -include_lib("typerefl/include/types.hrl"). -include_lib("hocon/include/hoconsc.hrl"). -export([namespace/0, roots/0, fields/1, translations/0, translation/1, desc/1, validations/0]). -export([upgrade_raw_conf/1]). +-export([injected_fields/0]). -define(EE_SCHEMA_MODULES, [ emqx_license_schema, @@ -127,6 +129,11 @@ desc(Name) -> validations() -> emqx_conf_schema:validations() ++ emqx_license_schema:validations(). +injected_fields() -> + #{ + 'node.role' => [replicant] + }. + %%------------------------------------------------------------------------------ %% helpers %%------------------------------------------------------------------------------ diff --git a/changes/ce/breaking-13526.en.md b/changes/ce/breaking-13526.en.md new file mode 100644 index 000000000..752e58ef3 --- /dev/null +++ b/changes/ce/breaking-13526.en.md @@ -0,0 +1,5 @@ +- Core-replicant feature has been removed from the Open-Source Edition. + Starting from release 5.8, all nodes running Open-Source Edition will assume Core role. + This change doesn't affect Enterprise Edition users. + +- Obsolete and unused `cluster.core_nodes` configuration parameter has been removed.