fix(emqx_conf_app): fix release version detect during cluster conf sync
This commit is contained in:
parent
dddccfdc5c
commit
045ed340dd
|
@ -180,17 +180,7 @@ sync_cluster_conf2(Nodes) ->
|
||||||
|
|
||||||
%% @private Filter out the nodes which are running a newer version than this node.
|
%% @private Filter out the nodes which are running a newer version than this node.
|
||||||
sync_cluster_conf3(Ready) ->
|
sync_cluster_conf3(Ready) ->
|
||||||
NotNewer = fun({ok, #{release := RemoteRelease}}) ->
|
case lists:filter(fun is_older_or_same_version/1, Ready) of
|
||||||
try
|
|
||||||
emqx_release:vsn_compare(RemoteRelease) =/= newer
|
|
||||||
catch
|
|
||||||
_:_ ->
|
|
||||||
%% If the version is not valid (without v or e prefix),
|
|
||||||
%% we know it's older than v5.1.0/e5.1.0
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
case lists:filter(NotNewer, Ready) of
|
|
||||||
[] ->
|
[] ->
|
||||||
%% All available core nodes are running a newer version than this node.
|
%% All available core nodes are running a newer version than this node.
|
||||||
%% Start this node without syncing cluster config from them.
|
%% Start this node without syncing cluster config from them.
|
||||||
|
@ -213,6 +203,19 @@ sync_cluster_conf3(Ready) ->
|
||||||
sync_cluster_conf4(Ready2)
|
sync_cluster_conf4(Ready2)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
is_older_or_same_version({ok, #{release := RemoteRelease}}) ->
|
||||||
|
try
|
||||||
|
emqx_release:vsn_compare(RemoteRelease) =/= newer
|
||||||
|
catch
|
||||||
|
_:_ ->
|
||||||
|
%% If the version is not valid (without v or e prefix),
|
||||||
|
%% we know it's older than v5.1.0/e5.1.0
|
||||||
|
true
|
||||||
|
end;
|
||||||
|
is_older_or_same_version(_) ->
|
||||||
|
%% older version has no 'release' field
|
||||||
|
true.
|
||||||
|
|
||||||
%% @private Some core nodes are running and replied with their configs successfully.
|
%% @private Some core nodes are running and replied with their configs successfully.
|
||||||
%% Try to sort the results and save the first one for local use.
|
%% Try to sort the results and save the first one for local use.
|
||||||
sync_cluster_conf4(Ready) ->
|
sync_cluster_conf4(Ready) ->
|
||||||
|
|
Loading…
Reference in New Issue