Skip to content

Commit

Permalink
feat: don't do rpc call to check deprecated file
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwencool committed Apr 24, 2023
1 parent 6dcecfe commit db0c951
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 124 deletions.
1 change: 0 additions & 1 deletion apps/emqx/priv/bpapi.versions
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
{emqx_cm,1}.
{emqx_conf,1}.
{emqx_conf,2}.
{emqx_conf,3}.
{emqx_dashboard,1}.
{emqx_delayed,1}.
{emqx_exhook,1}.
Expand Down
12 changes: 7 additions & 5 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 @@ -180,6 +181,8 @@ copy_override_conf_from_core_node() ->
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 @@ -228,13 +231,12 @@ sync_data_from_node(Node) ->
error(Error)
end.

has_deprecated_file(#{node := Node} = Info) ->
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
DataDir = emqx_conf_proto_v2:get_config(Node, [node, data_dir]),
File = filename:join([DataDir, "configs", "cluster-override.conf"]),
emqx_conf_proto_v3:file_exist(Node, File)
%% Conf is not empty if deprecated file is found.
Conf =/= #{}
end.
4 changes: 0 additions & 4 deletions apps/emqx_conf/src/proto/emqx_conf_proto_v2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

-export([
introduced_in/0,
deprecated_since/0,
sync_data_from_node/1,
get_config/2,
get_config/3,
Expand All @@ -42,9 +41,6 @@
introduced_in() ->
"5.0.1".

deprecated_since() ->
"5.0.23".

-spec sync_data_from_node(node()) -> {ok, binary()} | emqx_rpc:badrpc().
sync_data_from_node(Node) ->
rpc:call(Node, emqx_conf_app, sync_data_from_node, [], 20000).
Expand Down
114 changes: 0 additions & 114 deletions apps/emqx_conf/src/proto/emqx_conf_proto_v3.erl

This file was deleted.

0 comments on commit db0c951

Please sign in to comment.