fix(mria): Strictly check compatibility of the replicant with core
This commit is contained in:
parent
ed5a4aa921
commit
ba43da1b8e
|
@ -28,7 +28,7 @@
|
||||||
{gproc, {git, "https://github.com/emqx/gproc", {tag, "0.9.0.1"}}},
|
{gproc, {git, "https://github.com/emqx/gproc", {tag, "0.9.0.1"}}},
|
||||||
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}},
|
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}},
|
||||||
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.1"}}},
|
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.1"}}},
|
||||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.0"}}},
|
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.1"}}},
|
||||||
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}},
|
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}},
|
||||||
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.42.1"}}},
|
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.42.1"}}},
|
||||||
{emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.3"}}},
|
{emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.3"}}},
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([open_ports_check/0]).
|
-export([open_ports_check/0]).
|
||||||
|
-export([mria_lb_custom_info/0, mria_lb_custom_info_check/1]).
|
||||||
|
|
||||||
-ifdef(TEST).
|
-ifdef(TEST).
|
||||||
-export([create_plan/0]).
|
-export([create_plan/0]).
|
||||||
|
@ -51,6 +52,13 @@ start() ->
|
||||||
configure_shard_transports(),
|
configure_shard_transports(),
|
||||||
set_mnesia_extra_diagnostic_checks(),
|
set_mnesia_extra_diagnostic_checks(),
|
||||||
emqx_otel_app:configure_otel_deps(),
|
emqx_otel_app:configure_otel_deps(),
|
||||||
|
%% Register mria callbacks that help to check compatibility of the
|
||||||
|
%% replicant with the core node. Currently they rely on the exact
|
||||||
|
%% match of the version of EMQX OTP application:
|
||||||
|
_ = application:load(mria),
|
||||||
|
_ = application:load(emqx),
|
||||||
|
mria_config:register_callback(lb_custom_info, fun ?MODULE:mria_lb_custom_info/0),
|
||||||
|
mria_config:register_callback(lb_custom_info_check, fun ?MODULE:mria_lb_custom_info_check/1),
|
||||||
ekka:start(),
|
ekka:start(),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -227,3 +235,21 @@ resolve_dist_address_type() ->
|
||||||
_ ->
|
_ ->
|
||||||
inet
|
inet
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
%% Note: this function is stored in the Mria's application environment
|
||||||
|
mria_lb_custom_info() ->
|
||||||
|
get_emqx_vsn().
|
||||||
|
|
||||||
|
%% Note: this function is stored in the Mria's application environment
|
||||||
|
mria_lb_custom_info_check(undefined) ->
|
||||||
|
false;
|
||||||
|
mria_lb_custom_info_check(OtherVsn) ->
|
||||||
|
get_emqx_vsn() =:= OtherVsn.
|
||||||
|
|
||||||
|
get_emqx_vsn() ->
|
||||||
|
case application:get_key(emqx, vsn) of
|
||||||
|
{ok, Vsn} ->
|
||||||
|
Vsn;
|
||||||
|
undefined ->
|
||||||
|
undefined
|
||||||
|
end.
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Add a strict check that prevents replicant nodes from connecting to the core nodes running with a different version of EMQX application.
|
||||||
|
Effectively it means that during the rolling upgrades the replicant nodes can only work if there is at least one core node with the matching EMQX release.
|
2
mix.exs
2
mix.exs
|
@ -55,7 +55,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
{:cowboy, github: "emqx/cowboy", tag: "2.9.2", override: true},
|
{:cowboy, github: "emqx/cowboy", tag: "2.9.2", override: true},
|
||||||
{:esockd, github: "emqx/esockd", tag: "5.11.1", override: true},
|
{:esockd, github: "emqx/esockd", tag: "5.11.1", override: true},
|
||||||
{:rocksdb, github: "emqx/erlang-rocksdb", tag: "1.8.0-emqx-2", override: true},
|
{:rocksdb, github: "emqx/erlang-rocksdb", tag: "1.8.0-emqx-2", override: true},
|
||||||
{:ekka, github: "emqx/ekka", tag: "0.19.0", override: true},
|
{:ekka, github: "emqx/ekka", tag: "0.19.1", override: true},
|
||||||
{:gen_rpc, github: "emqx/gen_rpc", tag: "3.3.1", override: true},
|
{:gen_rpc, github: "emqx/gen_rpc", tag: "3.3.1", override: true},
|
||||||
{:grpc, github: "emqx/grpc-erl", tag: "0.6.12", override: true},
|
{:grpc, github: "emqx/grpc-erl", tag: "0.6.12", override: true},
|
||||||
{:minirest, github: "emqx/minirest", tag: "1.4.0", override: true},
|
{:minirest, github: "emqx/minirest", tag: "1.4.0", override: true},
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}},
|
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}},
|
||||||
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.1"}}},
|
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.1"}}},
|
||||||
{rocksdb, {git, "https://github.com/emqx/erlang-rocksdb", {tag, "1.8.0-emqx-2"}}},
|
{rocksdb, {git, "https://github.com/emqx/erlang-rocksdb", {tag, "1.8.0-emqx-2"}}},
|
||||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.0"}}},
|
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.1"}}},
|
||||||
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}},
|
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}},
|
||||||
{grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.12"}}},
|
{grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.12"}}},
|
||||||
{minirest, {git, "https://github.com/emqx/minirest", {tag, "1.4.0"}}},
|
{minirest, {git, "https://github.com/emqx/minirest", {tag, "1.4.0"}}},
|
||||||
|
|
Loading…
Reference in New Issue