From 34a69625b59491e816603ea6d70247deae8fb2bf Mon Sep 17 00:00:00 2001 From: William Yang Date: Wed, 22 May 2024 11:11:30 +0200 Subject: [PATCH 1/3] feat: quic-lb support --- apps/emqx/rebar.config.script | 3 ++- mix.exs | 4 +++- rebar.config.erl | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/emqx/rebar.config.script b/apps/emqx/rebar.config.script index 812aeae4671..6ec87ce64a0 100644 --- a/apps/emqx/rebar.config.script +++ b/apps/emqx/rebar.config.script @@ -24,7 +24,8 @@ IsQuicSupp = fun() -> end, Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}}, -Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.313"}}}. +Quicer = + {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.500"}}}. Dialyzer = fun(Config) -> {dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config), diff --git a/mix.exs b/mix.exs index b77e1da095d..552e2fd15a6 100644 --- a/mix.exs +++ b/mix.exs @@ -815,7 +815,9 @@ defmodule EMQXUmbrella.MixProject do defp quicer_dep() do if enable_quicer?(), # in conflict with emqx and emqtt - do: [{:quicer, github: "emqx/quic", tag: "0.0.313", override: true}], + do: [ + {:quicer, github: "emqx/quic", tag: "0.0.500", override: true} + ], else: [] end diff --git a/rebar.config.erl b/rebar.config.erl index 8320cc62a87..e24fdc2e237 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -36,7 +36,7 @@ assert_otp() -> end. quicer() -> - {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.313"}}}. + {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.500"}}}. jq() -> {jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.12"}}}. From d8eecfe64fd94957736c5ad811084471e916eaff Mon Sep 17 00:00:00 2001 From: William Yang Date: Wed, 22 May 2024 15:50:28 +0200 Subject: [PATCH 2/3] feat(quic-lb): add configuration --- apps/emqx_conf/src/emqx_conf_schema.erl | 10 ++++++++++ rel/i18n/emqx_conf_schema.hocon | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index 9b7277e345f..d5b902ba40e 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -218,6 +218,16 @@ fields("cluster") -> desc => ?DESC(cluster_proto_dist) } )}, + {"quic_lb_mode", + sc( + integer(), + #{ + mapping => "quicer.lb_mode", + default => 0, + 'readOnly' => true, + desc => ?DESC(cluster_quic_lb_mode) + } + )}, {"static", sc( ?R_REF(cluster_static), diff --git a/rel/i18n/emqx_conf_schema.hocon b/rel/i18n/emqx_conf_schema.hocon index be6526f48e6..cb593779eed 100644 --- a/rel/i18n/emqx_conf_schema.hocon +++ b/rel/i18n/emqx_conf_schema.hocon @@ -68,6 +68,15 @@ cluster_proto_dist.desc: cluster_proto_dist.label: """Cluster Protocol Distribution""" +cluster_quic_lb_mode.desc: +"""QUIC stack LB Mode +- 0: disabled (Default) +- 1: server_ip +- 2: server_id_fixed""" + +cluster_quic_lb_mode.label: +""" QUIC stack LB Mode """ + log_burst_limit_enable.desc: """Enable log burst control feature.""" From 94e59c8fa7ec869079021e314484adae2d22539b Mon Sep 17 00:00:00 2001 From: William Yang Date: Thu, 23 May 2024 10:32:00 +0200 Subject: [PATCH 3/3] feat(quic-lb): fix test --- apps/emqx/test/emqx_quic_multistreams_SUITE.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/emqx/test/emqx_quic_multistreams_SUITE.erl b/apps/emqx/test/emqx_quic_multistreams_SUITE.erl index 54c449a04d2..0ec3a8e7b00 100644 --- a/apps/emqx/test/emqx_quic_multistreams_SUITE.erl +++ b/apps/emqx/test/emqx_quic_multistreams_SUITE.erl @@ -841,7 +841,7 @@ t_conn_change_client_addr(Config) -> NewPort = select_port(), {ok, OldAddr} = quicer:sockname(Conn), ?assertEqual( - ok, quicer:setopt(Conn, param_conn_local_address, "127.0.0.1:" ++ integer_to_list(NewPort)) + ok, quicer:setopt(Conn, local_address, "127.0.0.1:" ++ integer_to_list(NewPort)) ), {ok, NewAddr} = quicer:sockname(Conn), ct:pal("NewAddr: ~p, Old Addr: ~p", [NewAddr, OldAddr]), @@ -1681,7 +1681,7 @@ t_client_conn_bump_streams(Config) -> ]), {ok, _} = emqtt:quic_connect(C), {quic, Conn, _Stream} = proplists:get_value(socket, emqtt:info(C)), - ok = quicer:setopt(Conn, param_conn_settings, #{peer_unidi_stream_count => 20}). + ok = quicer:setopt(Conn, settings, #{peer_unidi_stream_count => 20}). t_olp_true(Config) -> meck:new(emqx_olp, [passthrough, no_history]),