fix(mria): Reserve replicant role for EE only

This commit is contained in:
ieQu1 2024-07-26 12:17:00 +02:00
parent 39b8cb1789
commit 9da744c423
No known key found for this signature in database
GPG Key ID: 488654DF3FED6FDE
6 changed files with 27 additions and 27 deletions

View File

@ -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,

View File

@ -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) ->

View File

@ -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 = <<BaseConf/binary, (list_to_binary(Conf))/binary>>,
{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 = <<BaseConf/binary, Conf/binary>>,
{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 = <<BaseConf/binary, OKHttps/binary>>,
@ -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 = <<BaseConf/binary, ?LISTENERS>>,
{ok, ConfMap0} = hocon:binary(Conf, #{format => richmap}),

View File

@ -1,6 +1,6 @@
{application, emqx_enterprise, [
{description, "EMQX Enterprise Edition"},
{vsn, "0.2.2"},
{vsn, "0.2.3"},
{registered, []},
{applications, [
kernel,

View File

@ -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
%%------------------------------------------------------------------------------

View File

@ -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.