Merge pull request #10484 from zhongwencool/fix-copy-conf
fix: copy cluster-override.conf from old version
This commit is contained in:
commit
22d6a2eaee
|
@ -1,6 +1,6 @@
|
|||
{application, emqx_conf, [
|
||||
{description, "EMQX configuration management"},
|
||||
{vsn, "0.1.17"},
|
||||
{vsn, "0.1.18"},
|
||||
{registered, []},
|
||||
{mod, {emqx_conf_app, []}},
|
||||
{applications, [kernel, stdlib, emqx_ctl]},
|
||||
|
|
|
@ -66,7 +66,8 @@ get_override_config_file() ->
|
|||
conf => Conf,
|
||||
tnx_id => TnxId,
|
||||
node => Node,
|
||||
has_deprecated_file => HasDeprecateFile
|
||||
has_deprecated_file => HasDeprecateFile,
|
||||
release => emqx_app:get_release()
|
||||
}
|
||||
end,
|
||||
case mria:ro_transaction(?CLUSTER_RPC_SHARD, Fun) of
|
||||
|
@ -175,11 +176,13 @@ copy_override_conf_from_core_node() ->
|
|||
_ ->
|
||||
[{ok, Info} | _] = lists:sort(fun conf_sort/2, Ready),
|
||||
#{node := Node, conf := RawOverrideConf, tnx_id := TnxId} = Info,
|
||||
HasDeprecatedFile = maps:get(has_deprecated_file, Info, false),
|
||||
HasDeprecatedFile = has_deprecated_file(Info),
|
||||
?SLOG(debug, #{
|
||||
msg => "copy_cluster_conf_from_core_node_success",
|
||||
node => Node,
|
||||
has_deprecated_file => HasDeprecatedFile,
|
||||
local_release => emqx_app:get_release(),
|
||||
remote_release => maps:get(release, Info, "before_v5.0.24|e5.0.3"),
|
||||
data_dir => emqx:data_dir(),
|
||||
tnx_id => TnxId
|
||||
}),
|
||||
|
@ -227,3 +230,13 @@ sync_data_from_node(Node) ->
|
|||
?SLOG(emergency, #{node => Node, msg => "sync_data_from_node_failed", reason => Error}),
|
||||
error(Error)
|
||||
end.
|
||||
|
||||
has_deprecated_file(#{conf := Conf} = Info) ->
|
||||
case maps:find(has_deprecated_file, Info) of
|
||||
{ok, HasDeprecatedFile} ->
|
||||
HasDeprecatedFile;
|
||||
error ->
|
||||
%% The old version don't have emqx_config:has_deprecated_file/0
|
||||
%% Conf is not empty if deprecated file is found.
|
||||
Conf =/= #{}
|
||||
end.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Fix the issue that the priority of the configuration cannot be set during rolling upgrade.
|
||||
For example, when authorization is modified in v5.0.21 and then upgraded v5.0.23 through rolling upgrade,
|
||||
the authorization will be restored to the default.
|
Loading…
Reference in New Issue