Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: copy cluster-override.conf from old version #10484

Merged
merged 4 commits into from Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/emqx_conf/src/emqx_conf.app.src
@@ -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]},
Expand Down
17 changes: 15 additions & 2 deletions apps/emqx_conf/src/emqx_conf_app.erl
Expand Up @@ -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
Expand Down Expand Up @@ -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),
zhongwencool marked this conversation as resolved.
Show resolved Hide resolved
?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
}),
Expand Down Expand Up @@ -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.
3 changes: 3 additions & 0 deletions changes/ce/fix-10484.en.md
@@ -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.