Skip to content

Commit

Permalink
Merge pull request #10484 from zhongwencool/fix-copy-conf
Browse files Browse the repository at this point in the history
fix: copy cluster-override.conf from old version
  • Loading branch information
zhongwencool authored Apr 24, 2023
2 parents 366aa53 + db0c951 commit 22d6a2e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/emqx_conf/src/emqx_conf.app.src
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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),
?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
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 22d6a2e

Please sign in to comment.