From 07e1f2e4401328e78beaee96f9f8c5e605a9c962 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 30 Mar 2023 09:18:16 -0300 Subject: [PATCH 01/17] docs(kafka_producer): update ZH translation of field (rv5.0) Fixes https://emqx.atlassian.net/browse/EMQX-9411 --- lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf b/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf index df32c1cae..076619e91 100644 --- a/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf +++ b/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf @@ -62,7 +62,7 @@ emqx_ee_bridge_kafka { mqtt_topic { desc { en: "MQTT topic or topic as data source (bridge input). Should not configure this if the bridge is used as a rule action." - zh: "指定 MQTT 主题作为桥接的数据源。 若该桥接用于规则的动作,则必须将该配置项删除。" + zh: "桥接指定 MQTT 主题数据,也可以留空由规则动作指定数据源。" } label { en: "Source MQTT Topic" From aabbbf5deb069f5fcf584d5d298f5efbc1b72e24 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Fri, 31 Mar 2023 09:07:00 -0300 Subject: [PATCH 02/17] docs: improve descriptions Co-authored-by: Zaiming (Stone) Shi --- lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf b/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf index 076619e91..566d1889e 100644 --- a/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf +++ b/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf @@ -61,8 +61,8 @@ emqx_ee_bridge_kafka { } mqtt_topic { desc { - en: "MQTT topic or topic as data source (bridge input). Should not configure this if the bridge is used as a rule action." - zh: "桥接指定 MQTT 主题数据,也可以留空由规则动作指定数据源。" + en: "MQTT topic or topic filter as data source (bridge input). If rule action is used as data source, this config should be left empty, otherwise messages will be duplicated in Kafka." + zh: "指定源 MQTT 主题,若由规则动作指定数据源,则该配置应留空,否则消息会被重复发送到 Kafka。" } label { en: "Source MQTT Topic" From 51eec32d6bcc08f0c60ff99e38afa8d9d5fcc935 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 3 Apr 2023 09:11:14 -0300 Subject: [PATCH 03/17] docs: improve descriptions Co-authored-by: LenaLenaPan <120552185+LenaLenaPan@users.noreply.github.com> --- lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf b/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf index 566d1889e..badced748 100644 --- a/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf +++ b/lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf @@ -62,7 +62,7 @@ emqx_ee_bridge_kafka { mqtt_topic { desc { en: "MQTT topic or topic filter as data source (bridge input). If rule action is used as data source, this config should be left empty, otherwise messages will be duplicated in Kafka." - zh: "指定源 MQTT 主题,若由规则动作指定数据源,则该配置应留空,否则消息会被重复发送到 Kafka。" + zh: "MQTT 主题数据源由桥接指定,或留空由规则动作指定。" } label { en: "Source MQTT Topic" From 04626ce9cc59c95444c8fb8740a8fb176b7713bd Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Fri, 24 Mar 2023 16:42:21 +0100 Subject: [PATCH 04/17] fix: create consistent interface 'with_node' for API access --- apps/emqx/include/emqx_api_lib.hrl | 36 +++++++ apps/emqx/src/emqx_api_lib.erl | 69 ++++++++++++ apps/emqx/test/emqx_api_lib_SUITE.erl | 101 ++++++++++++++++++ apps/emqx_bridge/src/emqx_bridge_api.erl | 5 +- .../emqx_dashboard/src/emqx_dashboard.app.src | 2 +- .../src/emqx_dashboard_monitor_api.erl | 27 ++--- .../src/emqx_management.app.src | 2 +- .../src/emqx_mgmt_api_nodes.erl | 62 +++++------ .../test/emqx_mgmt_api_nodes_SUITE.erl | 6 +- changes/ce/fix-10237.en.md | 1 + 10 files changed, 249 insertions(+), 62 deletions(-) create mode 100644 apps/emqx/include/emqx_api_lib.hrl create mode 100644 apps/emqx/src/emqx_api_lib.erl create mode 100644 apps/emqx/test/emqx_api_lib_SUITE.erl create mode 100644 changes/ce/fix-10237.en.md diff --git a/apps/emqx/include/emqx_api_lib.hrl b/apps/emqx/include/emqx_api_lib.hrl new file mode 100644 index 000000000..549b0f94c --- /dev/null +++ b/apps/emqx/include/emqx_api_lib.hrl @@ -0,0 +1,36 @@ +%%-------------------------------------------------------------------- +%% Copyright (c) 2021-2023 EMQ Technologies Co., Ltd. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%%-------------------------------------------------------------------- + +-ifndef(EMQX_API_LIB_HRL). +-define(EMQX_API_LIB_HRL, true). + +-define(ERROR_MSG(CODE, REASON), #{code => CODE, message => emqx_misc:readable_error_msg(REASON)}). + +-define(OK(CONTENT), {200, CONTENT}). + +-define(NO_CONTENT, 204). + +-define(BAD_REQUEST(CODE, REASON), {400, ?ERROR_MSG(CODE, REASON)}). +-define(BAD_REQUEST(REASON), ?BAD_REQUEST('BAD_REQUEST', REASON)). + +-define(NOT_FOUND(REASON), {404, ?ERROR_MSG('NOT_FOUND', REASON)}). + +-define(INTERNAL_ERROR(REASON), {500, ?ERROR_MSG('INTERNAL_ERROR', REASON)}). + +-define(NOT_IMPLEMENTED, 501). + +-define(SERVICE_UNAVAILABLE(REASON), {503, ?ERROR_MSG('SERVICE_UNAVAILABLE', REASON)}). +-endif. diff --git a/apps/emqx/src/emqx_api_lib.erl b/apps/emqx/src/emqx_api_lib.erl new file mode 100644 index 000000000..8c49c57c3 --- /dev/null +++ b/apps/emqx/src/emqx_api_lib.erl @@ -0,0 +1,69 @@ +%%-------------------------------------------------------------------- +%% Copyright (c) 2020-2023 EMQ Technologies Co., Ltd. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%%-------------------------------------------------------------------- + +-module(emqx_api_lib). + +-export([ + with_node/2, + with_node_or_cluster/2 +]). + +-include("emqx_api_lib.hrl"). + +-define(NODE_NOT_FOUND(NODE), ?NOT_FOUND(<<"Node not found: ", NODE/binary>>)). + +%%-------------------------------------------------------------------- +%% exported API +%%-------------------------------------------------------------------- +-spec with_node(binary(), fun((atom()) -> {ok, term()} | {error, term()})) -> + ?OK(term()) | ?NOT_FOUND(binary()) | ?BAD_REQUEST(term()). +with_node(BinNode, Fun) -> + case lookup_node(BinNode) of + {ok, Node} -> + handle_result(Fun(Node)); + not_found -> + ?NODE_NOT_FOUND(BinNode) + end. + +-spec with_node_or_cluster(binary(), fun((atom()) -> {ok, term()} | {error, term()})) -> + ?OK(term()) | ?NOT_FOUND(iolist()) | ?BAD_REQUEST(term()). +with_node_or_cluster(<<"all">>, Fun) -> + handle_result(Fun(all)); +with_node_or_cluster(Node, Fun) -> + with_node(Node, Fun). + +%%-------------------------------------------------------------------- +%% Internal +%%-------------------------------------------------------------------- + +-spec lookup_node(binary()) -> {ok, atom()} | not_found. +lookup_node(BinNode) -> + case emqx_misc:safe_to_existing_atom(BinNode, utf8) of + {ok, Node} -> + case lists:member(Node, mria:running_nodes()) of + true -> + {ok, Node}; + false -> + not_found + end; + _Error -> + not_found + end. + +handle_result({ok, Result}) -> + ?OK(Result); +handle_result({error, Reason}) -> + ?BAD_REQUEST(Reason). diff --git a/apps/emqx/test/emqx_api_lib_SUITE.erl b/apps/emqx/test/emqx_api_lib_SUITE.erl new file mode 100644 index 000000000..29f5c6095 --- /dev/null +++ b/apps/emqx/test/emqx_api_lib_SUITE.erl @@ -0,0 +1,101 @@ +%%-------------------------------------------------------------------- +%% Copyright (c) 2020-2023 EMQ Technologies Co., Ltd. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%%-------------------------------------------------------------------- + +-module(emqx_api_lib_SUITE). + +-compile(export_all). +-compile(nowarn_export_all). + +-include("emqx_api_lib.hrl"). +-include_lib("eunit/include/eunit.hrl"). + +-define(DUMMY, dummy_module). + +all() -> emqx_common_test_helpers:all(?MODULE). + +init_per_suite(Config) -> + emqx_common_test_helpers:boot_modules(all), + emqx_common_test_helpers:start_apps([]), + Config. + +end_per_suite(_Config) -> + emqx_common_test_helpers:stop_apps([]). + +init_per_testcase(_Case, Config) -> + meck:new(?DUMMY, [non_strict]), + meck:expect(?DUMMY, expect_not_called, 1, fun(Node) -> throw({blow_this_up, Node}) end), + meck:expect(?DUMMY, expect_success, 1, {ok, success}), + meck:expect(?DUMMY, expect_error, 1, {error, error}), + Config. + +end_per_testcase(_Case, _Config) -> + meck:unload(?DUMMY). + +t_with_node(_) -> + test_with(fun emqx_api_lib:with_node/2, [<<"all">>]). + +t_with_node_or_cluster(_) -> + test_with(fun emqx_api_lib:with_node_or_cluster/2, []), + meck:reset(?DUMMY), + ?assertEqual( + ?OK(success), + emqx_api_lib:with_node_or_cluster( + <<"all">>, + fun ?DUMMY:expect_success/1 + ) + ), + ?assertMatch([{_, {?DUMMY, expect_success, [all]}, {ok, success}}], meck:history(?DUMMY)). + +%% helpers +test_with(TestFun, ExtraBadNodes) -> + % make sure this is an atom + 'unknownnode@unknownnohost', + BadNodes = + [ + <<"undefined">>, + <<"this_should_not_be_an_atom">>, + <<"unknownnode@unknownnohost">> + ] ++ ExtraBadNodes, + [ensure_not_found(TestFun(N, fun ?DUMMY:expect_not_called/1)) || N <- BadNodes], + ensure_not_called(?DUMMY, expect_not_called), + ensure_not_existing_atom(<<"this_should_not_be_an_atom">>), + + GoodNode = node(), + + ?assertEqual( + ?OK(success), + TestFun(GoodNode, fun ?DUMMY:expect_success/1) + ), + + ?assertEqual( + ?BAD_REQUEST(error), + TestFun(GoodNode, fun ?DUMMY:expect_error/1) + ), + ok. + +ensure_not_found(Result) -> + ?assertMatch({404, _}, Result). + +ensure_not_called(Mod, Fun) -> + ?assert(not meck:called(Mod, Fun, '_')). + +ensure_not_existing_atom(Bin) -> + try binary_to_existing_atom(Bin) of + _ -> throw(is_atom) + catch + error:badarg -> + ok + end. diff --git a/apps/emqx_bridge/src/emqx_bridge_api.erl b/apps/emqx_bridge/src/emqx_bridge_api.erl index b9a6d4c06..ff93ac584 100644 --- a/apps/emqx_bridge/src/emqx_bridge_api.erl +++ b/apps/emqx_bridge/src/emqx_bridge_api.erl @@ -20,6 +20,7 @@ -include_lib("typerefl/include/types.hrl"). -include_lib("hocon/include/hoconsc.hrl"). -include_lib("emqx/include/logger.hrl"). +-include_lib("emqx/include/emqx_api_lib.hrl"). -include_lib("emqx_bridge/include/emqx_bridge.hrl"). -import(hoconsc, [mk/2, array/1, enum/1]). @@ -46,14 +47,10 @@ -export([lookup_from_local_node/2]). --define(BAD_REQUEST(Reason), {400, error_msg('BAD_REQUEST', Reason)}). - -define(BRIDGE_NOT_ENABLED, ?BAD_REQUEST(<<"Forbidden operation, bridge not enabled">>) ). --define(NOT_FOUND(Reason), {404, error_msg('NOT_FOUND', Reason)}). - -define(BRIDGE_NOT_FOUND(BridgeType, BridgeName), ?NOT_FOUND( <<"Bridge lookup failed: bridge named '", (BridgeName)/binary, "' of type ", diff --git a/apps/emqx_dashboard/src/emqx_dashboard.app.src b/apps/emqx_dashboard/src/emqx_dashboard.app.src index 3970d76e4..8a4764c84 100644 --- a/apps/emqx_dashboard/src/emqx_dashboard.app.src +++ b/apps/emqx_dashboard/src/emqx_dashboard.app.src @@ -2,7 +2,7 @@ {application, emqx_dashboard, [ {description, "EMQX Web Dashboard"}, % strict semver, bump manually! - {vsn, "5.0.15"}, + {vsn, "5.0.16"}, {modules, []}, {registered, [emqx_dashboard_sup]}, {applications, [kernel, stdlib, mnesia, minirest, emqx, emqx_ctl]}, diff --git a/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl b/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl index 69f5bf34e..aaee92b8c 100644 --- a/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl +++ b/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl @@ -121,32 +121,27 @@ fields(sampler_current) -> monitor(get, #{query_string := QS, bindings := Bindings}) -> Latest = maps:get(<<"latest">>, QS, infinity), - RawNode = maps:get(node, Bindings, all), - with_node(RawNode, dashboard_samplers_fun(Latest)). + RawNode = maps:get(node, Bindings, <<"all">>), + emqx_api_lib:with_node_or_cluster(RawNode, dashboard_samplers_fun(Latest)). dashboard_samplers_fun(Latest) -> fun(NodeOrCluster) -> case emqx_dashboard_monitor:samplers(NodeOrCluster, Latest) of - {badrpc, _} = Error -> Error; + {badrpc, _} = Error -> {error, Error}; Samplers -> {ok, Samplers} end end. monitor_current(get, #{bindings := Bindings}) -> - RawNode = maps:get(node, Bindings, all), - with_node(RawNode, fun emqx_dashboard_monitor:current_rate/1). + RawNode = maps:get(node, Bindings, <<"all">>), + emqx_api_lib:with_node_or_cluster(RawNode, fun current_rate/1). -with_node(RawNode, Fun) -> - case emqx_misc:safe_to_existing_atom(RawNode, utf8) of - {ok, NodeOrCluster} -> - case Fun(NodeOrCluster) of - {badrpc, {Node, Reason}} -> - {404, 'NOT_FOUND', io_lib:format("Node not found: ~p (~p)", [Node, Reason])}; - {ok, Result} -> - {200, Result} - end; - _Error -> - {404, 'NOT_FOUND', io_lib:format("Node not found: ~p", [RawNode])} +current_rate(Node) -> + case emqx_dashboard_monitor:current_rate(Node) of + {badrpc, _} = BadRpc -> + {error, BadRpc}; + {ok, _} = OkResult -> + OkResult end. %% ------------------------------------------------------------------------------------------------- diff --git a/apps/emqx_management/src/emqx_management.app.src b/apps/emqx_management/src/emqx_management.app.src index 966358f47..9863f5cf6 100644 --- a/apps/emqx_management/src/emqx_management.app.src +++ b/apps/emqx_management/src/emqx_management.app.src @@ -2,7 +2,7 @@ {application, emqx_management, [ {description, "EMQX Management API and CLI"}, % strict semver, bump manually! - {vsn, "5.0.16"}, + {vsn, "5.0.17"}, {modules, []}, {registered, [emqx_management_sup]}, {applications, [kernel, stdlib, emqx_plugins, minirest, emqx, emqx_ctl]}, diff --git a/apps/emqx_management/src/emqx_mgmt_api_nodes.erl b/apps/emqx_management/src/emqx_mgmt_api_nodes.erl index 21d905331..a4173f5b0 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_nodes.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_nodes.erl @@ -17,7 +17,6 @@ -behaviour(minirest_api). --include_lib("emqx/include/emqx.hrl"). -include_lib("typerefl/include/types.hrl"). -import(hoconsc, [mk/2, ref/1, ref/2, enum/1, array/1]). @@ -25,8 +24,6 @@ -define(NODE_METRICS_MODULE, emqx_mgmt_api_metrics). -define(NODE_STATS_MODULE, emqx_mgmt_api_stats). --define(SOURCE_ERROR, 'SOURCE_ERROR'). - %% Swagger specs from hocon schema -export([ api_spec/0, @@ -88,7 +85,7 @@ schema("/nodes/:node") -> ref(node_info), #{desc => <<"Get node info successfully">>} ), - 400 => node_error() + 404 => not_found() } } }; @@ -106,7 +103,7 @@ schema("/nodes/:node/metrics") -> ref(?NODE_METRICS_MODULE, node_metrics), #{desc => <<"Get node metrics successfully">>} ), - 400 => node_error() + 404 => not_found() } } }; @@ -124,7 +121,7 @@ schema("/nodes/:node/stats") -> ref(?NODE_STATS_MODULE, node_stats_data), #{desc => <<"Get node stats successfully">>} ), - 400 => node_error() + 404 => not_found() } } }. @@ -136,7 +133,7 @@ fields(node_name) -> [ {node, mk( - atom(), + binary(), #{ in => path, description => <<"Node name">>, @@ -250,55 +247,46 @@ nodes(get, _Params) -> list_nodes(#{}). node(get, #{bindings := #{node := NodeName}}) -> - get_node(NodeName). + emqx_api_lib:with_node(NodeName, to_ok_result_fun(fun get_node/1)). node_metrics(get, #{bindings := #{node := NodeName}}) -> - get_metrics(NodeName). + emqx_api_lib:with_node(NodeName, to_ok_result_fun(fun emqx_mgmt:get_metrics/1)). node_stats(get, #{bindings := #{node := NodeName}}) -> - get_stats(NodeName). + emqx_api_lib:with_node(NodeName, to_ok_result_fun(fun emqx_mgmt:get_stats/1)). %%-------------------------------------------------------------------- %% api apply list_nodes(#{}) -> - NodesInfo = [format(Node, NodeInfo) || {Node, NodeInfo} <- emqx_mgmt:list_nodes()], + NodesInfo = [format(NodeInfo) || {_Node, NodeInfo} <- emqx_mgmt:list_nodes()], {200, NodesInfo}. get_node(Node) -> - case emqx_mgmt:lookup_node(Node) of - {error, _} -> - {400, #{code => 'SOURCE_ERROR', message => <<"rpc_failed">>}}; - NodeInfo -> - {200, format(Node, NodeInfo)} - end. - -get_metrics(Node) -> - case emqx_mgmt:get_metrics(Node) of - {error, _} -> - {400, #{code => 'SOURCE_ERROR', message => <<"rpc_failed">>}}; - Metrics -> - {200, Metrics} - end. - -get_stats(Node) -> - case emqx_mgmt:get_stats(Node) of - {error, _} -> - {400, #{code => 'SOURCE_ERROR', message => <<"rpc_failed">>}}; - Stats -> - {200, Stats} - end. + format(emqx_mgmt:lookup_node(Node)). %%-------------------------------------------------------------------- %% internal function -format(_Node, Info = #{memory_total := Total, memory_used := Used}) -> +format(Info = #{memory_total := Total, memory_used := Used}) -> Info#{ memory_total := emqx_mgmt_util:kmg(Total), memory_used := emqx_mgmt_util:kmg(Used) }; -format(_Node, Info) when is_map(Info) -> +format(Info) when is_map(Info) -> Info. -node_error() -> - emqx_dashboard_swagger:error_codes([?SOURCE_ERROR], <<"Node error">>). +to_ok_result({error, _} = Error) -> + Error; +to_ok_result({ok, _} = Ok) -> + Ok; +to_ok_result(Result) -> + {ok, Result}. + +to_ok_result_fun(Fun) when is_function(Fun) -> + fun(Arg) -> + to_ok_result(Fun(Arg)) + end. + +not_found() -> + emqx_dashboard_swagger:error_codes(['NOT_FOUND'], <<"Node not found">>). diff --git a/apps/emqx_management/test/emqx_mgmt_api_nodes_SUITE.erl b/apps/emqx_management/test/emqx_mgmt_api_nodes_SUITE.erl index 03b0ea2d9..30313e555 100644 --- a/apps/emqx_management/test/emqx_mgmt_api_nodes_SUITE.erl +++ b/apps/emqx_management/test/emqx_mgmt_api_nodes_SUITE.erl @@ -68,7 +68,7 @@ t_nodes_api(_) -> BadNodePath = emqx_mgmt_api_test_util:api_path(["nodes", "badnode"]), ?assertMatch( - {error, {_, 400, _}}, + {error, {_, 404, _}}, emqx_mgmt_api_test_util:request_api(get, BadNodePath) ). @@ -94,7 +94,7 @@ t_node_stats_api(_) -> BadNodePath = emqx_mgmt_api_test_util:api_path(["nodes", "badnode", "stats"]), ?assertMatch( - {error, {_, 400, _}}, + {error, {_, 404, _}}, emqx_mgmt_api_test_util:request_api(get, BadNodePath) ). @@ -112,7 +112,7 @@ t_node_metrics_api(_) -> BadNodePath = emqx_mgmt_api_test_util:api_path(["nodes", "badnode", "metrics"]), ?assertMatch( - {error, {_, 400, _}}, + {error, {_, 404, _}}, emqx_mgmt_api_test_util:request_api(get, BadNodePath) ). diff --git a/changes/ce/fix-10237.en.md b/changes/ce/fix-10237.en.md new file mode 100644 index 000000000..cf3fc707b --- /dev/null +++ b/changes/ce/fix-10237.en.md @@ -0,0 +1 @@ +Ensure we return `404` status code for unknown node names in `/nodes/:node[/metrics|/stats]` API. From c20da5ffa6decba63b573f78d5caf14e740fe61b Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Mon, 3 Apr 2023 11:55:36 +0200 Subject: [PATCH 05/17] fix(emqx_dashboard): fix monitor_current api --- apps/emqx_dashboard/src/emqx_dashboard.app.src | 2 +- apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/emqx_dashboard/src/emqx_dashboard.app.src b/apps/emqx_dashboard/src/emqx_dashboard.app.src index 3970d76e4..8a4764c84 100644 --- a/apps/emqx_dashboard/src/emqx_dashboard.app.src +++ b/apps/emqx_dashboard/src/emqx_dashboard.app.src @@ -2,7 +2,7 @@ {application, emqx_dashboard, [ {description, "EMQX Web Dashboard"}, % strict semver, bump manually! - {vsn, "5.0.15"}, + {vsn, "5.0.16"}, {modules, []}, {registered, [emqx_dashboard_sup]}, {applications, [kernel, stdlib, mnesia, minirest, emqx, emqx_ctl]}, diff --git a/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl b/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl index 69f5bf34e..34a8f0231 100644 --- a/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl +++ b/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl @@ -132,6 +132,8 @@ dashboard_samplers_fun(Latest) -> end end. +monitor_current(get, #{bindings := []}) -> + with_node(erlang:node(), fun emqx_dashboard_monitor:current_rate/1); monitor_current(get, #{bindings := Bindings}) -> RawNode = maps:get(node, Bindings, all), with_node(RawNode, fun emqx_dashboard_monitor:current_rate/1). From 3d7ceb01a0ba4af0d68fee5598a7bc1f70d7b972 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Mon, 3 Apr 2023 14:14:21 +0200 Subject: [PATCH 06/17] fix(mgmt): fix stats api by applying filter to running_nodes --- apps/emqx_management/src/emqx_management.app.src | 2 +- apps/emqx_management/src/emqx_mgmt_api_stats.erl | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/emqx_management/src/emqx_management.app.src b/apps/emqx_management/src/emqx_management.app.src index 966358f47..9863f5cf6 100644 --- a/apps/emqx_management/src/emqx_management.app.src +++ b/apps/emqx_management/src/emqx_management.app.src @@ -2,7 +2,7 @@ {application, emqx_management, [ {description, "EMQX Management API and CLI"}, % strict semver, bump manually! - {vsn, "5.0.16"}, + {vsn, "5.0.17"}, {modules, []}, {registered, [emqx_management_sup]}, {applications, [kernel, stdlib, emqx_plugins, minirest, emqx, emqx_ctl]}, diff --git a/apps/emqx_management/src/emqx_mgmt_api_stats.erl b/apps/emqx_management/src/emqx_mgmt_api_stats.erl index 1d3c0e21b..105f6c047 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_stats.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_stats.erl @@ -129,7 +129,19 @@ list(get, #{query_string := Qs}) -> _ -> Data = [ maps:from_list(emqx_mgmt:get_stats(Node) ++ [{node, Node}]) - || Node <- mria:running_nodes() + || Node <- running_nodes() ], {200, Data} end. + +%%%============================================================================================== +%% Internal + +running_nodes() -> + Nodes = erlang:nodes([visible, this]), + RpcResults = erpc:multicall(Nodes, emqx, is_running, [], 15000), + [ + Node + || {Node, IsRunning} <- lists:zip(Nodes, RpcResults), + IsRunning =:= {ok, true} + ]. From 2571da368cf9ba18f07476fec32dca2fc86947eb Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Mon, 3 Apr 2023 15:28:18 +0200 Subject: [PATCH 07/17] chore: add changelog --- changes/ce/fix-10314.en.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changes/ce/fix-10314.en.md diff --git a/changes/ce/fix-10314.en.md b/changes/ce/fix-10314.en.md new file mode 100644 index 000000000..0557e714e --- /dev/null +++ b/changes/ce/fix-10314.en.md @@ -0,0 +1,2 @@ +Fix /monitor_current API so that it only looks at the current node. +Fix /stats API to not crash when one or more nodes in the cluster are down. From 9d1a16aae1c329a3fb4fe5e3fc1d9c20782d5bf2 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 4 Apr 2023 20:40:47 +0200 Subject: [PATCH 08/17] feat: add emqx_rpc:multicall_on_running also move emqx:is_running multicall to emqx_proto_v2:are_running --- apps/emqx/priv/bpapi.versions | 1 + apps/emqx/src/emqx_rpc.erl | 13 +++ apps/emqx/src/proto/emqx_proto_v2.erl | 86 +++++++++++++++++++ .../src/emqx_mgmt_api_stats.erl | 2 +- 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 apps/emqx/src/proto/emqx_proto_v2.erl diff --git a/apps/emqx/priv/bpapi.versions b/apps/emqx/priv/bpapi.versions index 6190925d2..c5619102c 100644 --- a/apps/emqx/priv/bpapi.versions +++ b/apps/emqx/priv/bpapi.versions @@ -1,5 +1,6 @@ %% This file is automatically generated by `make static_checks`, do not edit. {emqx,1}. +{emqx,2}. {emqx_authn,1}. {emqx_authz,1}. {emqx_bridge,1}. diff --git a/apps/emqx/src/emqx_rpc.erl b/apps/emqx/src/emqx_rpc.erl index e1b5122c4..062bde68b 100644 --- a/apps/emqx/src/emqx_rpc.erl +++ b/apps/emqx/src/emqx_rpc.erl @@ -27,6 +27,8 @@ cast/5, multicall/4, multicall/5, + multicall_on_running/5, + on_running/3, unwrap_erpc/1 ]). @@ -91,6 +93,17 @@ multicall(Nodes, Mod, Fun, Args) -> multicall(Key, Nodes, Mod, Fun, Args) -> gen_rpc:multicall(rpc_nodes([{Key, Node} || Node <- Nodes]), Mod, Fun, Args). +-spec multicall_on_running([node()], module(), atom(), list(), timeout()) -> [term() | {error, _}]. +multicall_on_running(Nodes, Mod, Fun, Args, Timeout) -> + unwrap_erpc(erpc:multicall(Nodes, emqx_rpc, on_running, [Mod, Fun, Args], Timeout)). + +-spec on_running(module(), atom(), list()) -> term(). +on_running(Mod, Fun, Args) -> + case emqx:is_running() of + true -> apply(Mod, Fun, Args); + false -> error(emqx_down) + end. + -spec cast(node(), module(), atom(), list()) -> cast_result(). cast(Node, Mod, Fun, Args) -> %% Note: using a non-ordered cast here, since the generated key is diff --git a/apps/emqx/src/proto/emqx_proto_v2.erl b/apps/emqx/src/proto/emqx_proto_v2.erl new file mode 100644 index 000000000..a11c8a10e --- /dev/null +++ b/apps/emqx/src/proto/emqx_proto_v2.erl @@ -0,0 +1,86 @@ +%%-------------------------------------------------------------------- +%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%%-------------------------------------------------------------------- + +-module(emqx_proto_v2). + +-behaviour(emqx_bpapi). + +-include("bpapi.hrl"). + +-export([ + introduced_in/0, + + are_running/1, + is_running/1, + + get_alarms/2, + get_stats/1, + get_metrics/1, + + deactivate_alarm/2, + delete_all_deactivated_alarms/1, + + clean_authz_cache/1, + clean_authz_cache/2, + clean_pem_cache/1 +]). + +introduced_in() -> + "5.0.22". + +-spec is_running(node()) -> boolean() | {badrpc, term()}. +is_running(Node) -> + rpc:call(Node, emqx, is_running, []). + +-spec are_running([node()]) -> emqx_rpc:erpc_multicall(boolean()). +are_running(Nodes) when is_list(Nodes) -> + erpc:multicall(Nodes, emqx, is_running, []). + +-spec get_alarms(node(), all | activated | deactivated) -> [map()]. +get_alarms(Node, Type) -> + rpc:call(Node, emqx_alarm, get_alarms, [Type]). + +-spec get_stats(node()) -> emqx_stats:stats() | {badrpc, _}. +get_stats(Node) -> + rpc:call(Node, emqx_stats, getstats, []). + +-spec get_metrics(node()) -> [{emqx_metrics:metric_name(), non_neg_integer()}] | {badrpc, _}. +get_metrics(Node) -> + rpc:call(Node, emqx_metrics, all, []). + +-spec clean_authz_cache(node(), emqx_types:clientid()) -> + ok + | {error, not_found} + | {badrpc, _}. +clean_authz_cache(Node, ClientId) -> + rpc:call(Node, emqx_authz_cache, drain_cache, [ClientId]). + +-spec clean_authz_cache(node()) -> ok | {badrpc, _}. +clean_authz_cache(Node) -> + rpc:call(Node, emqx_authz_cache, drain_cache, []). + +-spec clean_pem_cache(node()) -> ok | {badrpc, _}. +clean_pem_cache(Node) -> + rpc:call(Node, ssl_pem_cache, clear, []). + +-spec deactivate_alarm(node(), binary() | atom()) -> + ok | {error, not_found} | {badrpc, _}. +deactivate_alarm(Node, Name) -> + rpc:call(Node, emqx_alarm, deactivate, [Name]). + +-spec delete_all_deactivated_alarms(node()) -> ok | {badrpc, _}. +delete_all_deactivated_alarms(Node) -> + rpc:call(Node, emqx_alarm, delete_all_deactivated_alarms, []). diff --git a/apps/emqx_management/src/emqx_mgmt_api_stats.erl b/apps/emqx_management/src/emqx_mgmt_api_stats.erl index 105f6c047..1e752aaac 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_stats.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_stats.erl @@ -139,7 +139,7 @@ list(get, #{query_string := Qs}) -> running_nodes() -> Nodes = erlang:nodes([visible, this]), - RpcResults = erpc:multicall(Nodes, emqx, is_running, [], 15000), + RpcResults = emqx_proto_v2:are_running(Nodes), [ Node || {Node, IsRunning} <- lists:zip(Nodes, RpcResults), From bbb3fdb49ecac3e24a45b0850f2fddad426a7893 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Thu, 6 Apr 2023 16:57:02 +0800 Subject: [PATCH 09/17] fix: make emqx_api_lib compatible --- apps/emqx/src/emqx_api_lib.erl | 32 +++++++++++-------- .../src/emqx_dashboard_monitor_api.erl | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/apps/emqx/src/emqx_api_lib.erl b/apps/emqx/src/emqx_api_lib.erl index 8c49c57c3..f1d65f350 100644 --- a/apps/emqx/src/emqx_api_lib.erl +++ b/apps/emqx/src/emqx_api_lib.erl @@ -28,17 +28,17 @@ %%-------------------------------------------------------------------- %% exported API %%-------------------------------------------------------------------- --spec with_node(binary(), fun((atom()) -> {ok, term()} | {error, term()})) -> +-spec with_node(binary() | atom(), fun((atom()) -> {ok, term()} | {error, term()})) -> ?OK(term()) | ?NOT_FOUND(binary()) | ?BAD_REQUEST(term()). -with_node(BinNode, Fun) -> - case lookup_node(BinNode) of +with_node(Node0, Fun) -> + case lookup_node(Node0) of {ok, Node} -> handle_result(Fun(Node)); not_found -> - ?NODE_NOT_FOUND(BinNode) + ?NODE_NOT_FOUND(Node0) end. --spec with_node_or_cluster(binary(), fun((atom()) -> {ok, term()} | {error, term()})) -> +-spec with_node_or_cluster(binary() | atom(), fun((atom()) -> {ok, term()} | {error, term()})) -> ?OK(term()) | ?NOT_FOUND(iolist()) | ?BAD_REQUEST(term()). with_node_or_cluster(<<"all">>, Fun) -> handle_result(Fun(all)); @@ -49,18 +49,24 @@ with_node_or_cluster(Node, Fun) -> %% Internal %%-------------------------------------------------------------------- --spec lookup_node(binary()) -> {ok, atom()} | not_found. -lookup_node(BinNode) -> +-spec lookup_node(atom() | binary()) -> {ok, atom()} | not_found. +lookup_node(BinNode) when is_binary(BinNode) -> case emqx_misc:safe_to_existing_atom(BinNode, utf8) of {ok, Node} -> - case lists:member(Node, mria:running_nodes()) of - true -> - {ok, Node}; - false -> - not_found - end; + is_running_node(Node); _Error -> not_found + end; +lookup_node(Node) when is_atom(Node) -> + is_running_node(Node). + +-spec is_running_node(atom()) -> {ok, atom()} | not_found. +is_running_node(Node) -> + case lists:member(Node, mria:running_nodes()) of + true -> + {ok, Node}; + false -> + not_found end. handle_result({ok, Result}) -> diff --git a/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl b/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl index f0b5ef574..c2dd4a9dd 100644 --- a/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl +++ b/apps/emqx_dashboard/src/emqx_dashboard_monitor_api.erl @@ -133,7 +133,7 @@ dashboard_samplers_fun(Latest) -> end. monitor_current(get, #{bindings := []}) -> - with_node(erlang:node(), fun emqx_dashboard_monitor:current_rate/1); + emqx_api_lib:with_node_or_cluster(erlang:node(), fun emqx_dashboard_monitor:current_rate/1); monitor_current(get, #{bindings := Bindings}) -> RawNode = maps:get(node, Bindings, <<"all">>), emqx_api_lib:with_node_or_cluster(RawNode, fun current_rate/1). From 11a7770d163f5ade6b3739ad342f2969793f3005 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Thu, 6 Apr 2023 11:57:07 +0200 Subject: [PATCH 10/17] chore: bump version to e5.0.2-rc.5 --- apps/emqx/include/emqx_release.hrl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx/include/emqx_release.hrl b/apps/emqx/include/emqx_release.hrl index 76920928b..6394d940e 100644 --- a/apps/emqx/include/emqx_release.hrl +++ b/apps/emqx/include/emqx_release.hrl @@ -35,7 +35,7 @@ -define(EMQX_RELEASE_CE, "5.0.21"). %% Enterprise edition --define(EMQX_RELEASE_EE, "5.0.2-rc.4"). +-define(EMQX_RELEASE_EE, "5.0.2-rc.5"). %% the HTTP API version -define(EMQX_API_VERSION, "5.0"). From 4c24b08244b27afa59f25c8184024ba734d17f28 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 6 Apr 2023 15:30:45 -0300 Subject: [PATCH 11/17] fix(rule_action): fix metrics for bridges returning `async_return` Kafka Producer, when called asynchronously, will return `{async_return, {ok, pid()}}`, which currently counts as an unknown failure. --- apps/emqx_rule_engine/src/emqx_rule_runtime.erl | 6 ++++-- .../test/emqx_bridge_impl_kafka_producer_SUITE.erl | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/emqx_rule_engine/src/emqx_rule_runtime.erl b/apps/emqx_rule_engine/src/emqx_rule_runtime.erl index 153832246..51491df53 100644 --- a/apps/emqx_rule_engine/src/emqx_rule_runtime.erl +++ b/apps/emqx_rule_engine/src/emqx_rule_runtime.erl @@ -508,8 +508,6 @@ nested_put(Alias, Val, Columns0) -> emqx_rule_maps:nested_put(Alias, Val, Columns). -define(IS_RES_DOWN(R), R == stopped; R == not_connected; R == not_found). -inc_action_metrics(ok, RuleId) -> - emqx_metrics_worker:inc(rule_metrics, RuleId, 'actions.success'); inc_action_metrics({error, {recoverable_error, _}}, RuleId) -> emqx_metrics_worker:inc(rule_metrics, RuleId, 'actions.failed.out_of_service'); inc_action_metrics(?RESOURCE_ERROR_M(R, _), RuleId) when ?IS_RES_DOWN(R) -> @@ -525,6 +523,10 @@ inc_action_metrics(R, RuleId) -> emqx_metrics_worker:inc(rule_metrics, RuleId, 'actions.success') end. +is_ok_result(ok) -> + true; +is_ok_result({async_return, R}) -> + is_ok_result(R); is_ok_result(R) when is_tuple(R) -> ok == erlang:element(1, R); is_ok_result(_) -> diff --git a/lib-ee/emqx_ee_bridge/test/emqx_bridge_impl_kafka_producer_SUITE.erl b/lib-ee/emqx_ee_bridge/test/emqx_bridge_impl_kafka_producer_SUITE.erl index 9e32f818d..9b6ac05a7 100644 --- a/lib-ee/emqx_ee_bridge/test/emqx_bridge_impl_kafka_producer_SUITE.erl +++ b/lib-ee/emqx_ee_bridge/test/emqx_bridge_impl_kafka_producer_SUITE.erl @@ -309,7 +309,7 @@ kafka_bridge_rest_api_helper(Config) -> AtomsAfter = erlang:system_info(atom_count), ?assertEqual(AtomsBefore, AtomsAfter), %% Create a rule that uses the bridge - {ok, 201, _Rule} = http_post( + {ok, 201, Rule} = http_post( ["rules"], #{ <<"name">> => <<"kafka_bridge_rest_api_helper_rule">>, @@ -318,6 +318,7 @@ kafka_bridge_rest_api_helper(Config) -> <<"sql">> => <<"SELECT * from \"kafka_bridge_topic/#\"">> } ), + #{<<"id">> := RuleId} = emqx_json:decode(Rule, [return_maps]), %% counters should be empty before ?assertEqual(0, emqx_resource_metrics:matched_get(ResourceId)), ?assertEqual(0, emqx_resource_metrics:success_get(ResourceId)), @@ -346,6 +347,8 @@ kafka_bridge_rest_api_helper(Config) -> %% Check crucial counters and gauges ?assertEqual(1, emqx_resource_metrics:matched_get(ResourceId)), ?assertEqual(1, emqx_resource_metrics:success_get(ResourceId)), + ?assertEqual(1, emqx_metrics_worker:get(rule_metrics, RuleId, 'actions.success')), + ?assertEqual(0, emqx_metrics_worker:get(rule_metrics, RuleId, 'actions.failed')), ?assertEqual(0, emqx_resource_metrics:dropped_get(ResourceId)), ?assertEqual(0, emqx_resource_metrics:failed_get(ResourceId)), ?assertEqual(0, emqx_resource_metrics:inflight_get(ResourceId)), From 7c05304ff42a7e6e74583c6bf76b219bebc4cc40 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Thu, 6 Apr 2023 16:53:55 -0300 Subject: [PATCH 12/17] chore: bump version to e5.0.2-rc.6 --- apps/emqx/include/emqx_release.hrl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx/include/emqx_release.hrl b/apps/emqx/include/emqx_release.hrl index 6394d940e..fa339be36 100644 --- a/apps/emqx/include/emqx_release.hrl +++ b/apps/emqx/include/emqx_release.hrl @@ -35,7 +35,7 @@ -define(EMQX_RELEASE_CE, "5.0.21"). %% Enterprise edition --define(EMQX_RELEASE_EE, "5.0.2-rc.5"). +-define(EMQX_RELEASE_EE, "5.0.2-rc.6"). %% the HTTP API version -define(EMQX_API_VERSION, "5.0"). From ffa8f21d2e0e1bbb1d7552bb557225a82201776f Mon Sep 17 00:00:00 2001 From: Kinplemelon Date: Fri, 7 Apr 2023 18:02:04 +0800 Subject: [PATCH 13/17] chore: upgrade dashboard to v1.2.1 for ce --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 410140616..28c4b16e7 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ export EMQX_DEFAULT_BUILDER = ghcr.io/emqx/emqx-builder/5.0-28:1.13.4-24.3.4.2-2 export EMQX_DEFAULT_RUNNER = debian:11-slim export OTP_VSN ?= $(shell $(CURDIR)/scripts/get-otp-vsn.sh) export ELIXIR_VSN ?= $(shell $(CURDIR)/scripts/get-elixir-vsn.sh) -export EMQX_DASHBOARD_VERSION ?= v1.2.0 +export EMQX_DASHBOARD_VERSION ?= v1.2.1 export EMQX_EE_DASHBOARD_VERSION ?= e1.0.5 export EMQX_REL_FORM ?= tgz export QUICER_DOWNLOAD_FROM_RELEASE = 1 From a711ce6b936b4f347b5619013afa0ab975884b36 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Mon, 10 Apr 2023 18:10:31 +0200 Subject: [PATCH 14/17] chore: bump version to e5.0.2 --- apps/emqx/include/emqx_release.hrl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx/include/emqx_release.hrl b/apps/emqx/include/emqx_release.hrl index fa339be36..84f4468e4 100644 --- a/apps/emqx/include/emqx_release.hrl +++ b/apps/emqx/include/emqx_release.hrl @@ -35,7 +35,7 @@ -define(EMQX_RELEASE_CE, "5.0.21"). %% Enterprise edition --define(EMQX_RELEASE_EE, "5.0.2-rc.6"). +-define(EMQX_RELEASE_EE, "5.0.2"). %% the HTTP API version -define(EMQX_API_VERSION, "5.0"). From 00301935bbe6dde4402d9b17d9bb3f1eaf5d029d Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 11 Apr 2023 08:56:46 +0200 Subject: [PATCH 15/17] chore: update changelog entries --- changes/ce/feat-9986.en.md | 2 +- changes/ce/fix-10014.en.md | 2 +- changes/ce/fix-10014.zh.md | 2 +- changes/ce/fix-10055.en.md | 2 +- changes/ce/fix-10107.en.md | 2 +- changes/ce/fix-10154.zh.md | 1 + changes/ce/fix-10237.zh.md | 1 + changes/ce/fix-10251.zh.md | 1 + changes/ce/fix-10314.zh.md | 1 + changes/ce/fix-10327.zh.md | 1 + changes/ee/feat-9564.en.md | 2 +- changes/ee/feat-9881.en.md | 2 +- 12 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 changes/ce/fix-10154.zh.md create mode 100644 changes/ce/fix-10237.zh.md create mode 100644 changes/ce/fix-10251.zh.md create mode 100644 changes/ce/fix-10314.zh.md create mode 100644 changes/ce/fix-10327.zh.md diff --git a/changes/ce/feat-9986.en.md b/changes/ce/feat-9986.en.md index ee7a6be71..7a63c2e74 100644 --- a/changes/ce/feat-9986.en.md +++ b/changes/ce/feat-9986.en.md @@ -1 +1 @@ -For helm charts, add MQTT ingress bridge; and removed stale `mgmt` references. +Add MQTT ingress to helm charts and update helm charts documentation diff --git a/changes/ce/fix-10014.en.md b/changes/ce/fix-10014.en.md index d52452bf9..2a3674772 100644 --- a/changes/ce/fix-10014.en.md +++ b/changes/ce/fix-10014.en.md @@ -1 +1 @@ -In dashboard API for `/monitor(_current)/nodes/:node` return `404` instead of `400` if node does not exist. +Ensure Monitor API `/monitor(_current)/nodes/:node` returns `404` instead of `400` if node does not exist. diff --git a/changes/ce/fix-10014.zh.md b/changes/ce/fix-10014.zh.md index 5e6a1660f..1ce2a3c43 100644 --- a/changes/ce/fix-10014.zh.md +++ b/changes/ce/fix-10014.zh.md @@ -1 +1 @@ -如果 API 查询的节点不存在,将会返回 404 而不再是 400。 +如果 API 查询的节点不存在,将会返回 `404` 而不再是 `400`。 diff --git a/changes/ce/fix-10055.en.md b/changes/ce/fix-10055.en.md index 15237c135..b22a319c6 100644 --- a/changes/ce/fix-10055.en.md +++ b/changes/ce/fix-10055.en.md @@ -1 +1 @@ -Fix: configuration parameter `mqtt.max_awaiting_rel` had no effect. +The configuration parameter `mqtt.max_awaiting_rel` was not functional and has now been corrected. diff --git a/changes/ce/fix-10107.en.md b/changes/ce/fix-10107.en.md index 1bcbbad60..6f76bc083 100644 --- a/changes/ce/fix-10107.en.md +++ b/changes/ce/fix-10107.en.md @@ -1,4 +1,4 @@ -For operations on `bridges API` if `bridge-id` is unknown we now return `404` +For operations on Bridges API if `bridge-id` is unknown we now return `404` instead of `400`. Also a bug was fixed that caused a crash if that was a node operation. Additionally we now also check if the given bridge is enabled when doing the cluster operation `start` . Affected endpoints: diff --git a/changes/ce/fix-10154.zh.md b/changes/ce/fix-10154.zh.md new file mode 100644 index 000000000..8adf365ae --- /dev/null +++ b/changes/ce/fix-10154.zh.md @@ -0,0 +1 @@ +将数据桥接和连接器的 resume_interval 参数值设为 health_check_interval 和 request_timeout / 3 中的较小值,以解决请求超时的问题。 diff --git a/changes/ce/fix-10237.zh.md b/changes/ce/fix-10237.zh.md new file mode 100644 index 000000000..c4bae060f --- /dev/null +++ b/changes/ce/fix-10237.zh.md @@ -0,0 +1 @@ +当调用 `/nodes/:node[/metrics|/stats]` API ,若节点不存在则返回 `404` 状态码。 diff --git a/changes/ce/fix-10251.zh.md b/changes/ce/fix-10251.zh.md new file mode 100644 index 000000000..0c2e0ba09 --- /dev/null +++ b/changes/ce/fix-10251.zh.md @@ -0,0 +1 @@ +修复了当删除一个使用中的 ingress 类型的桥接时,未提示存在规则依赖的问题。 diff --git a/changes/ce/fix-10314.zh.md b/changes/ce/fix-10314.zh.md new file mode 100644 index 000000000..8b99197ca --- /dev/null +++ b/changes/ce/fix-10314.zh.md @@ -0,0 +1 @@ +修复 `/monitor_current` API ,使其仅查看当前 节点。修复了 `/stats` API,以防止当集群中的一个或多个节点关闭时出现崩溃。 diff --git a/changes/ce/fix-10327.zh.md b/changes/ce/fix-10327.zh.md new file mode 100644 index 000000000..e99bda40a --- /dev/null +++ b/changes/ce/fix-10327.zh.md @@ -0,0 +1 @@ +在收到不可恢复的错误时,不要增加 'actions.failed.unknown' 规则指标计数。 diff --git a/changes/ee/feat-9564.en.md b/changes/ee/feat-9564.en.md index 4405e3e07..93cbcdb0d 100644 --- a/changes/ee/feat-9564.en.md +++ b/changes/ee/feat-9564.en.md @@ -1,2 +1,2 @@ -Implemented Kafka Consumer bridge. +Implement Kafka Consumer bridge. Now it's possible to consume messages from Kafka and publish them to MQTT topics. diff --git a/changes/ee/feat-9881.en.md b/changes/ee/feat-9881.en.md index 546178965..b5c6de484 100644 --- a/changes/ee/feat-9881.en.md +++ b/changes/ee/feat-9881.en.md @@ -1,4 +1,4 @@ -In this pull request, we have enhanced the error logs related to InfluxDB connectivity health checks. +Enhance the error logs related to InfluxDB connectivity health checks. Previously, if InfluxDB failed to pass the health checks using the specified parameters, the only message provided was "timed out waiting for it to become healthy". With the updated implementation, the error message will be displayed in both the logs and the dashboard, enabling easier identification and resolution of the issue. From 33811ebf5977426a7a9360086167cf0c319007fa Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 11 Apr 2023 13:21:57 +0200 Subject: [PATCH 16/17] docs: Generate changelog for e5.0.2 --- changes/e5.0.2.en.md | 135 +++++++++++++++++++++++++++++++++++++++++++ changes/e5.0.2.zh.md | 118 +++++++++++++++++++++++++++++++++++++ 2 files changed, 253 insertions(+) create mode 100644 changes/e5.0.2.en.md create mode 100644 changes/e5.0.2.zh.md diff --git a/changes/e5.0.2.en.md b/changes/e5.0.2.en.md new file mode 100644 index 000000000..8d552ec17 --- /dev/null +++ b/changes/e5.0.2.en.md @@ -0,0 +1,135 @@ +# e5.0.2 + +## Enhancements + +- [#10022](https://github.com/emqx/emqx/pull/10022) Start releasing Rocky Linux 9 (compatible with Enterprise Linux 9) and MacOS 12 packages + +- [#10139](https://github.com/emqx/emqx/pull/10139) Add `extraVolumeMounts` to EMQX Helm Chart, it will have the ability to mount the user-own files into the EMQX instance, for example, ACL rule files as mentioned in [#9052](https://github.com/emqx/emqx/issues/9052) + Done of [#10116](https://github.com/emqx/emqx/issues/10116) + +- [#9893](https://github.com/emqx/emqx/pull/9893) When connecting with the flag `clean_start=false`, EMQX will filter out messages that published by banned clients. + Previously, the messages sent by banned clients may still be delivered to subscribers in this scenario. + +- [#9986](https://github.com/emqx/emqx/pull/9986) Add MQTT ingress to helm charts and update helm charts documentation + +- [#10083](https://github.com/emqx/emqx/pull/10083) Add `DynamoDB` support for Data-Brdige. + +- [#9564](https://github.com/emqx/emqx/pull/9564) Implement Kafka Consumer bridge. + Now it's possible to consume messages from Kafka and publish them to MQTT topics. + +- [#9881](https://github.com/emqx/emqx/pull/9881) Enhance the error logs related to InfluxDB connectivity health checks. + Previously, if InfluxDB failed to pass the health checks using the specified parameters, the only message provided was "timed out waiting for it to become healthy". + With the updated implementation, the error message will be displayed in both the logs and the dashboard, enabling easier identification and resolution of the issue. + +- [#10123](https://github.com/emqx/emqx/pull/10123) Improve the performance of `/bridges` API. + Earlier, when the number of nodes in the cluster was large or the node was busy, the API may have a request timeout. + +- [#9998](https://github.com/emqx/emqx/pull/9998) Redact the HTTP request body in the authentication error logs for security reasons. + +## Bug Fixes + +- [#10013](https://github.com/emqx/emqx/pull/10013) Fix return type structure for error case in API schema for `/gateways/:name/clients`. + +- [#10014](https://github.com/emqx/emqx/pull/10014) Ensure Monitor API `/monitor(_current)/nodes/:node` returns `404` instead of `400` if node does not exist. + +- [#10026](https://github.com/emqx/emqx/pull/10026) Metrics are now only exposed via the /bridges/:id/metrics endpoint. Metrics are no longer returned in other API operations such as getting the list of all bridges, or in the response when a bridge has been created. + +- [#10027](https://github.com/emqx/emqx/pull/10027) Allow setting node name from `EMQX_NODE__NAME` when running in docker. + Prior to this fix, only `EMQX_NODE_NAME` is allowed. + +- [#10050](https://github.com/emqx/emqx/pull/10050) Ensure Bridge API returns `404` status code consistently for resources that don't exist. + +- [#10052](https://github.com/emqx/emqx/pull/10052) Improve daemon mode startup failure logs. + + Before this change, it was difficult for users to understand the reason for EMQX 'start' command failed to boot the node. + The only information they received was that the node did not start within the expected time frame, + and they were instructed to boot the node with 'console' command in the hope of obtaining some logs. + However, the node might actually be running, which could cause 'console' mode to fail for a different reason. + + With this new change, when daemon mode fails to boot, a diagnosis is issued. Here are the possible scenarios: + + * If the node cannot be found from `ps -ef`, the user is instructed to find information in log files `erlang.log.*`. + * If the node is found to be running but not responding to pings, the user is advised to check if the host name is resolvable and reachable. + * If the node is responding to pings, but the EMQX app is not running, it is likely a bug. In this case, the user is advised to report a Github issue. + +- [#10055](https://github.com/emqx/emqx/pull/10055) The configuration parameter `mqtt.max_awaiting_rel` was not functional and has now been corrected. + +- [#10056](https://github.com/emqx/emqx/pull/10056) Fix `/bridges` API status code. + - Return `400` instead of `403` in case of removing a data bridge that is dependent on an active rule. + - Return `400` instead of `403` in case of calling operations (start|stop|restart) when Data-Bridging is not enabled. + +- [#10066](https://github.com/emqx/emqx/pull/10066) Improve error messages for `/briges_probe` and `[/node/:node]/bridges/:id/:operation` API calls to make them more readable. And set HTTP status code to `400` instead of `500`. + +- [#10074](https://github.com/emqx/emqx/pull/10074) Check if type in `PUT /authorization/sources/:type` matches `type` given in body of request. + +- [#10079](https://github.com/emqx/emqx/pull/10079) Fix description of `shared_subscription_strategy`. + +- [#10085](https://github.com/emqx/emqx/pull/10085) Consistently return `404` for all requests on non existent source in `/authorization/sources/:source[/*]`. + +- [#10098](https://github.com/emqx/emqx/pull/10098) A crash with an error in the log file that happened when the MongoDB authorization module queried the database has been fixed. + +- [#10100](https://github.com/emqx/emqx/pull/10100) Fix channel crash for slow clients with enhanced authentication. + Previously, when the client was using enhanced authentication, but the Auth message was sent slowly or the Auth message was lost, the client process would crash. + +- [#10107](https://github.com/emqx/emqx/pull/10107) For operations on Bridges API if `bridge-id` is unknown we now return `404` + instead of `400`. Also a bug was fixed that caused a crash if that was a node + operation. Additionally we now also check if the given bridge is enabled when + doing the cluster operation `start` . Affected endpoints: + * [cluster] `/bridges/:id/:operation`, + * [node] `/nodes/:node/bridges/:id/:operation`, where `operation` is one of + `[start|stop|restart]`. + Moreover, for a node operation, EMQX checks if node name is in our cluster and + return `404` instead of `501`. + +- [#10117](https://github.com/emqx/emqx/pull/10117) Fix an error occurring when a joining node doesn't have plugins that are installed on other nodes in the cluster. + After this fix, the joining node will copy all the necessary plugins from other nodes. + +- [#10118](https://github.com/emqx/emqx/pull/10118) Fix problems related to manual joining of EMQX replicant nodes to the cluster. + Previously, after manually executing joining and then leaving the cluster, the `replicant` node can only run normally after restarting the node after joining the cluster again. + + [Mria PR](https://github.com/emqx/mria/pull/128) + +- [#10119](https://github.com/emqx/emqx/pull/10119) Fix crash when `statsd.server` is set to an empty string. + +- [#10124](https://github.com/emqx/emqx/pull/10124) The default heartbeat period for MongoDB has been increased to reduce the risk of too excessive logging to the MongoDB log file. + +- [#10130](https://github.com/emqx/emqx/pull/10130) Fix garbled config display in dashboard when the value is originally from environment variables. + For example, `env EMQX_STATSD__SERVER='127.0.0.1:8124' . /bin/emqx start` results in unreadable string (not '127.0.0.1:8124') displayed in Dashboard's Statsd settings page. + Related PR: [HOCON#234](https://github.com/emqx/hocon/pull/234). + +- [#10132](https://github.com/emqx/emqx/pull/10132) Fix some error logs generated by `systemctl stop emqx` command. + Prior to the fix, the command was not stopping jq and os_mon applications properly. + +- [#10144](https://github.com/emqx/emqx/pull/10144) Add `-setcookie` emulator flag when invoking `emqx ctl` to prevent problems with emqx cli when home directory is read only. Fixes [#10142](https://github.com/emqx/emqx/issues/10142). + +- [#10154](https://github.com/emqx/emqx/pull/10154) Change the default `resume_interval` for bridges and connectors to be + the minimum of `health_check_interval` and `request_timeout / 3`. + Also exposes it as a hidden configuration to allow fine tuning. + + Before this change, the default values for `resume_interval` meant + that, if a buffer ever got blocked due to resource errors or high + message volumes, then, by the time the buffer would try to resume its + normal operations, almost all requests would have timed out. + +- [#10157](https://github.com/emqx/emqx/pull/10157) Fixed default rate limit configuration not being applied correctly when creating a new listener. + +- [#10237](https://github.com/emqx/emqx/pull/10237) Ensure we return `404` status code for unknown node names in `/nodes/:node[/metrics|/stats]` API. + +- [#10251](https://github.com/emqx/emqx/pull/10251) Consider bridges referenced in `FROM` rule clauses as dependencies. + + Before this fix, when one tried to delete an ingress rule referenced in an action like `select * from "$bridges/mqtt:ingress"`, the UI would not trigger a warning about dependent rule actions. + +- [#10313](https://github.com/emqx/emqx/pull/10313) Ensure that when the core or replicant node starting, the `cluster-override.conf` file is only copied from the core node. + Previously, when sorting nodes by startup time, the core node may have copied this file from the replicant node. + +- [#10314](https://github.com/emqx/emqx/pull/10314) Fix /monitor_current API so that it only looks at the current node. + Fix /stats API to not crash when one or more nodes in the cluster are down. + +- [#10327](https://github.com/emqx/emqx/pull/10327) Don't increment 'actions.failed.unknown' rule metrics counter upon receiving unrecoverable bridge errors. + This counter is displayed on the dashboard's rule overview tab ('Action statistics' - 'Unknown'). + The fix is only applicable for synchronous bridges, as all rule actions for asynchronous bridges + are counted as successful (they increment 'actions.success' which is displayed as 'Action statistics' - 'Success'). + +- [#10095](https://github.com/emqx/emqx/pull/10095) Stop MySQL client from bombarding server repeatedly with unnecessary `PREPARE` queries on every batch, trashing the server and exhausting its internal limits. This was happening when the MySQL bridge was in the batch mode. + + Ensure safer and more careful escaping of strings and binaries in batch insert queries when the MySQL bridge is in the batch mode. diff --git a/changes/e5.0.2.zh.md b/changes/e5.0.2.zh.md new file mode 100644 index 000000000..a73372570 --- /dev/null +++ b/changes/e5.0.2.zh.md @@ -0,0 +1,118 @@ +# e5.0.2 + +## 增强 + +- [#10022](https://github.com/emqx/emqx/pull/10022) 开始发布Rocky Linux 9(与Enterprise Linux 9兼容)和 MacOS 12 软件包。 + +- [#10139](https://github.com/emqx/emqx/pull/10139) 将 `extraVolumeMounts` 添加到 EMQX Helm Chart 中,它将能够挂载用户自己的文件到 EMQX 实例中,例如在 [#9052](https://github.com/emqx/emqx/issues/9052) 中提到的 ACL 规则文件。 + 修复了 issue [#10116](https://github.com/emqx/emqx/issues/10116) + +- [#9893](https://github.com/emqx/emqx/pull/9893) 当使用 `clean_start=false` 标志连接时,EMQX 将会从消息队列中过滤出被封禁客户端发出的消息,使它们不能被下发给订阅者。 + 此前被封禁客户端发出的消息仍可能在这一场景下被下发给订阅者。 + +- [#9986](https://github.com/emqx/emqx/pull/9986) 在 helm chart 中新增了 MQTT 桥接 ingress 的配置参数;并删除了旧版本遗留的 `mgmt` 配置。 + +- [#10083](https://github.com/emqx/emqx/pull/10083) 为数据桥接增加 `DynamoDB` 支持。 + +- [#9564](https://github.com/emqx/emqx/pull/9564) 实现了 Kafka 消费者桥接。 + 现在可以从 Kafka 消费消息并将其发布到 MQTT 主题。 + +- [#9881](https://github.com/emqx/emqx/pull/9881) 增强了与 InfluxDB 连接健康检查相关的错误日志。 + 在此更改之前,如果使用配置的参数 InfluxDB 未能通过健康检查,用户仅能获得一个“超时”的信息。 + 现在,详细的错误消息将显示在日志和控制台,从而让用户更容易地识别和解决问题。 + +- [#10123](https://github.com/emqx/emqx/pull/10123) 改进 `/bridges` API 的性能。 + 此前,当集群中节点数目较多或节点忙时,该 API 可能出现请求超时的情况。 + +- [#9998](https://github.com/emqx/emqx/pull/9998) 出于安全原因,在身份验证错误日志中模糊 HTTP 请求正文。 + +## 修复 + +- [#10013](https://github.com/emqx/emqx/pull/10013) 修复 API `/gateways/:name/clients` 返回值的类型结构错误。 + +- [#10014](https://github.com/emqx/emqx/pull/10014) 如果 API 查询的节点不存在,将会返回 `404` 而不再是 `400`。 + +- [#10026](https://github.com/emqx/emqx/pull/10026) 现在只有显式调用 `/bridges/:id/metrics` 接口时才可以获得指标数据,而其他 API 接口将不再返回相关数据。 + +- [#10027](https://github.com/emqx/emqx/pull/10027) 在 docker 中启动时,允许使用 `EMQX_NODE__NAME` 环境变量来配置节点名。 + 在此修复前,只能使 `EMQX_NODE_NAME`。 + +- [#10050](https://github.com/emqx/emqx/pull/10050) 确保 Bridge API 对不存在的资源一致返回 `404` 状态代码。 + +- [#10052](https://github.com/emqx/emqx/pull/10052) 优化 EMQX daemon 模式启动启动失败的日志。 + + 在进行此更改之前,当 EMQX 用 `start` 命令启动失败时,用户很难理解出错的原因。 + 所知道的仅仅是节点未能在预期时间内启动,然后被指示以 `console` 式引导节点以获取一些日志。 + 然而,节点实际上可能正在运行,这可能会导致 `console` 模式因不同的原因而失败。 + + 此次修复后,启动脚本会发出诊断: + + * 如果无法从 `ps -ef` 中找到节点,则指示用户在 `erlang.log.*` 中查找信息。 + * 如果发现节点正在运行但不响应 ping,则建议用户检查节点主机名是否有效并可达。 + * 如果节点响应 ping 但 EMQX 应用程序未运行,则很可能是一个错误。在这种情况下,建议用户报告一个Github issue。 + +- [#10055](https://github.com/emqx/emqx/pull/10055) 修复配置项 `mqtt.max_awaiting_rel` 更新不生效问题。 + +- [#10056](https://github.com/emqx/emqx/pull/10056) 修复 `/bridges` API 的 HTTP 状态码。 + - 当删除被活动中的规则依赖的数据桥接时,将返回 `400` 而不是 `403` 。 + - 当数据桥接未启用时,调用操作(启动|停止|重启)将返回 `400` 而不是 `403`。 + +- [#10066](https://github.com/emqx/emqx/pull/10066) 改进 `/briges_probe` 和 `[/node/:node]/bridges/:id/:operation` API 调用的错误信息,使之更加易读。并将 HTTP 状态代码设置为 `400` 而不是 `500`。 + +- [#10074](https://github.com/emqx/emqx/pull/10074) 检查 `PUT /authorization/sources/:type` 中的类型是否与请求正文中的 `type` 相符。 + +- [#10079](https://github.com/emqx/emqx/pull/10079) 修正对 `shared_subscription_strategy` 的描述。 + + +- [#10085](https://github.com/emqx/emqx/pull/10085) 如果向 `/authorization/sources/:source[/*]` 请求的 `source` 不存在,将一致地返回 `404`。 + +- [#10098](https://github.com/emqx/emqx/pull/10098) 当 MongoDB 授权模块查询数据库时,在日志文件中发生的崩溃与错误已经被修复。 + +- [#10100](https://github.com/emqx/emqx/pull/10100) 修复响应较慢的客户端在使用增强认证时可能出现崩溃的问题。 + 此前,当客户端使用增强认证功能,但发送 Auth 报文较慢或 Auth 报文丢失时会导致客户端进程崩溃。 + +- [#10107](https://github.com/emqx/emqx/pull/10107) 现在对桥接的 API 进行调用时,如果 `bridge-id` 不存在,将会返回 `404`,而不再是`400`。 + 然后,还修复了这种情况下,在节点级别上进行 API 调用时,可能导致崩溃的问题。 + 另外,在启动某个桥接时,会先检查指定桥接是否已启用。 + 受影响的接口有: + * [cluster] `/bridges/:id/:operation`, + * [node] `/nodes/:node/bridges/:id/:operation`, + 其中 `operation` 是 `[start|stop|restart]` 之一。 + 此外,对于节点操作,EMQX 将检查节点是否存在于集群中,如果不在,则会返回`404`,而不再是`501`。 + +- [#10117](https://github.com/emqx/emqx/pull/10117) 修复节点加入集群时,由于缺少集其它节点已安装的插件所导致的错误。 + 在此修复后,加入集群的节点将从其它节点复制所有必须的插件。 + +- [#10118](https://github.com/emqx/emqx/pull/10118) 修复 `replicant` 节点因为手动加入 EMQX 集群导致的相关问题。 + 此前,手动执行 `加入集群-离开集群` 后,`replicant` 节点再次加入集群后只有重启节点才能正常运行。 + + [Mria PR](https://github.com/emqx/mria/pull/128) + +- [#10119](https://github.com/emqx/emqx/pull/10119) 修复 `statsd.server` 配置为空字符串时启动崩溃的问题。 + +- [#10124](https://github.com/emqx/emqx/pull/10124) 增加了 MongoDB 的默认心跳周期,以减少 MongoDB 日志文件记录过多的风险。 + +- [#10130](https://github.com/emqx/emqx/pull/10130) 修复通过环境变量配置启动的 EMQX 节点无法通过HTTP API获取到正确的配置信息。 + 比如:`EMQX_STATSD__SERVER='127.0.0.1:8124' ./bin/emqx start` 后通过 Dashboard看到的 Statsd 配置信息是乱码。 + 相关 PR: [HOCON:234](https://github.com/emqx/hocon/pull/234). + +- [#10132](https://github.com/emqx/emqx/pull/10132) 修复 `systemctl stop emqx` 命令没有正常停止 jq、os_mon 组件所产生一些错误日志。 + +- [#10144](https://github.com/emqx/emqx/pull/10144) 为 emqx 可执行文件加入 `-setcookie` 标志,以避免由于 home 目录只读,导致 emqx cli 所提供的 `emqx ctl` 等命令在执行时出现的一些问题。修复 [#10142](https://github.com/emqx/emqx/issues/10142)。 + +- [#10154](https://github.com/emqx/emqx/pull/10154) 将数据桥接和连接器的 resume_interval 参数值设为 health_check_interval 和 request_timeout / 3 中的较小值,以解决请求超时的问题。 + +- [#10157](https://github.com/emqx/emqx/pull/10157) 修复在创建新的监听器时,没有正确应用速率限制默认配置的问题。 + +- [#10237](https://github.com/emqx/emqx/pull/10237) 当调用 `/nodes/:node[/metrics|/stats]` API ,若节点不存在则返回 `404` 状态码。 + +- [#10251](https://github.com/emqx/emqx/pull/10251) 修复了当删除一个使用中的 ingress 类型的桥接时,未提示存在规则依赖的问题。 + +- [#10313](https://github.com/emqx/emqx/pull/10313) 确保当 core 或 replicant 节点启动时,仅从 core 节点复制 `cluster-override.conf` 文件。 + 此前按照节点启动时间排序时,core 节点可能从 replicant 节点复制该文件。 + +- [#10314](https://github.com/emqx/emqx/pull/10314) 修复 `/monitor_current` API ,使其仅查看当前 节点。修复了 `/stats` API,以防止当集群中的一个或多个节点关闭时出现崩溃。 + +- [#10327](https://github.com/emqx/emqx/pull/10327) 在收到不可恢复的错误时,不要增加 'actions.failed.unknown' 规则指标计数。 + +- [#10095](https://github.com/emqx/emqx/pull/10095) 优化 MySQL 桥接在批量模式下能更高效的使用预处理语句 ,减少了对 MySQL 服务器的写入压力, 并确保对 SQL 语句进行更安全和谨慎的转义。 From 8bf65c507e0fb7dd398f5a0efe11d4832b063c3f Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 11 Apr 2023 18:46:38 +0200 Subject: [PATCH 17/17] chore: update changelog --- changes/e5.0.2.en.md | 114 +++++++++++++----------------------------- changes/e5.0.2.zh.md | 115 ++++++++++++++----------------------------- 2 files changed, 71 insertions(+), 158 deletions(-) diff --git a/changes/e5.0.2.en.md b/changes/e5.0.2.en.md index 8d552ec17..83eecdfe9 100644 --- a/changes/e5.0.2.en.md +++ b/changes/e5.0.2.en.md @@ -2,29 +2,28 @@ ## Enhancements -- [#10022](https://github.com/emqx/emqx/pull/10022) Start releasing Rocky Linux 9 (compatible with Enterprise Linux 9) and MacOS 12 packages +- [#10022](https://github.com/emqx/emqx/pull/10022) Release installation packages for Rocky Linux 9 (compatible with Red Hat Enterprise Linux 9) and macOS 12 for Intel platform. -- [#10139](https://github.com/emqx/emqx/pull/10139) Add `extraVolumeMounts` to EMQX Helm Chart, it will have the ability to mount the user-own files into the EMQX instance, for example, ACL rule files as mentioned in [#9052](https://github.com/emqx/emqx/issues/9052) - Done of [#10116](https://github.com/emqx/emqx/issues/10116) +- [#10139](https://github.com/emqx/emqx/pull/10139) Add `extraVolumeMounts` to EMQX Helm Chart, you can mount user's own files to EMQX instance, such as ACL rule files mentioned in [#9052](https://github.com/emqx/emqx/issues/9052). -- [#9893](https://github.com/emqx/emqx/pull/9893) When connecting with the flag `clean_start=false`, EMQX will filter out messages that published by banned clients. - Previously, the messages sent by banned clients may still be delivered to subscribers in this scenario. +- [#9893](https://github.com/emqx/emqx/pull/9893) When connecting with the flag `clean_start=false`, EMQX will filter out messages that published by clients banned by the blacklist feature in the session. +Previously, messages sent by clients banned by the blacklist feature could still be delivered to subscribers in this case. -- [#9986](https://github.com/emqx/emqx/pull/9986) Add MQTT ingress to helm charts and update helm charts documentation +- [#9986](https://github.com/emqx/emqx/pull/9986) Add MQTT ingress to helm charts and remove obsolete mgmt references. -- [#10083](https://github.com/emqx/emqx/pull/10083) Add `DynamoDB` support for Data-Brdige. +- [#9564](https://github.com/emqx/emqx/pull/9564) Implement Kafka Consumer Bridge, which supports consuming messages from Kafka and publishing them to MQTT topics. -- [#9564](https://github.com/emqx/emqx/pull/9564) Implement Kafka Consumer bridge. - Now it's possible to consume messages from Kafka and publish them to MQTT topics. - -- [#9881](https://github.com/emqx/emqx/pull/9881) Enhance the error logs related to InfluxDB connectivity health checks. - Previously, if InfluxDB failed to pass the health checks using the specified parameters, the only message provided was "timed out waiting for it to become healthy". - With the updated implementation, the error message will be displayed in both the logs and the dashboard, enabling easier identification and resolution of the issue. +- [#9881](https://github.com/emqx/emqx/pull/9881) Improve error logging related to health checks for InfluxDB connections. - [#10123](https://github.com/emqx/emqx/pull/10123) Improve the performance of `/bridges` API. - Earlier, when the number of nodes in the cluster was large or the node was busy, the API may have a request timeout. +Earlier, when the number of nodes in the cluster was large or the node was busy, the API may had a request timeout. + +- [#9998](https://github.com/emqx/emqx/pull/9998) Obfuscate request body in error log when using HTTP service for client authentication for security reasons. + +- [#10026](https://github.com/emqx/emqx/pull/10026) Metrics are now only exposed via the `/bridges/:id/metrics` endpoint, and no longer returned in other API operations. + +- [#10052](https://github.com/emqx/emqx/pull/10052) Improve startup failure logs in daemon mode. -- [#9998](https://github.com/emqx/emqx/pull/9998) Redact the HTTP request body in the authentication error logs for security reasons. ## Bug Fixes @@ -32,104 +31,57 @@ - [#10014](https://github.com/emqx/emqx/pull/10014) Ensure Monitor API `/monitor(_current)/nodes/:node` returns `404` instead of `400` if node does not exist. -- [#10026](https://github.com/emqx/emqx/pull/10026) Metrics are now only exposed via the /bridges/:id/metrics endpoint. Metrics are no longer returned in other API operations such as getting the list of all bridges, or in the response when a bridge has been created. - -- [#10027](https://github.com/emqx/emqx/pull/10027) Allow setting node name from `EMQX_NODE__NAME` when running in docker. - Prior to this fix, only `EMQX_NODE_NAME` is allowed. +- [#10027](https://github.com/emqx/emqx/pull/10027) Allow setting node name via environment variable `EMQX_NODE__NAME` in Docker. - [#10050](https://github.com/emqx/emqx/pull/10050) Ensure Bridge API returns `404` status code consistently for resources that don't exist. -- [#10052](https://github.com/emqx/emqx/pull/10052) Improve daemon mode startup failure logs. - - Before this change, it was difficult for users to understand the reason for EMQX 'start' command failed to boot the node. - The only information they received was that the node did not start within the expected time frame, - and they were instructed to boot the node with 'console' command in the hope of obtaining some logs. - However, the node might actually be running, which could cause 'console' mode to fail for a different reason. - - With this new change, when daemon mode fails to boot, a diagnosis is issued. Here are the possible scenarios: - - * If the node cannot be found from `ps -ef`, the user is instructed to find information in log files `erlang.log.*`. - * If the node is found to be running but not responding to pings, the user is advised to check if the host name is resolvable and reachable. - * If the node is responding to pings, but the EMQX app is not running, it is likely a bug. In this case, the user is advised to report a Github issue. - - [#10055](https://github.com/emqx/emqx/pull/10055) The configuration parameter `mqtt.max_awaiting_rel` was not functional and has now been corrected. - [#10056](https://github.com/emqx/emqx/pull/10056) Fix `/bridges` API status code. - - Return `400` instead of `403` in case of removing a data bridge that is dependent on an active rule. - - Return `400` instead of `403` in case of calling operations (start|stop|restart) when Data-Bridging is not enabled. + Return `400` instead of `403` in case of removing a data bridge that is dependent on an active rule. + Return `400` instead of `403` in case of calling operations (start|stop|restart) when Data-Bridging is not enabled. - [#10066](https://github.com/emqx/emqx/pull/10066) Improve error messages for `/briges_probe` and `[/node/:node]/bridges/:id/:operation` API calls to make them more readable. And set HTTP status code to `400` instead of `500`. -- [#10074](https://github.com/emqx/emqx/pull/10074) Check if type in `PUT /authorization/sources/:type` matches `type` given in body of request. +- [#10074](https://github.com/emqx/emqx/pull/10074) Check if type in `PUT /authorization/sources/:type` matches `type` given in the request body. -- [#10079](https://github.com/emqx/emqx/pull/10079) Fix description of `shared_subscription_strategy`. +- [#10079](https://github.com/emqx/emqx/pull/10079) Fix wrong description about `shared_subscription_strategy`. -- [#10085](https://github.com/emqx/emqx/pull/10085) Consistently return `404` for all requests on non existent source in `/authorization/sources/:source[/*]`. +- [#10085](https://github.com/emqx/emqx/pull/10085) Consistently return `404` for all requests on non-existent source in `/authorization/sources/:source[/*]`. -- [#10098](https://github.com/emqx/emqx/pull/10098) A crash with an error in the log file that happened when the MongoDB authorization module queried the database has been fixed. +- [#10098](https://github.com/emqx/emqx/pull/10098) Fix an issue where the MongoDB connector crashed when MongoDB authorization was configured. -- [#10100](https://github.com/emqx/emqx/pull/10100) Fix channel crash for slow clients with enhanced authentication. - Previously, when the client was using enhanced authentication, but the Auth message was sent slowly or the Auth message was lost, the client process would crash. +- [#10100](https://github.com/emqx/emqx/pull/10100) Fix channel crash for slow clients with enhanced authentication. +Previously, when the client was using enhanced authentication, but the Auth message was sent slowly or the Auth message was lost, the client process would crash. -- [#10107](https://github.com/emqx/emqx/pull/10107) For operations on Bridges API if `bridge-id` is unknown we now return `404` - instead of `400`. Also a bug was fixed that caused a crash if that was a node - operation. Additionally we now also check if the given bridge is enabled when - doing the cluster operation `start` . Affected endpoints: - * [cluster] `/bridges/:id/:operation`, - * [node] `/nodes/:node/bridges/:id/:operation`, where `operation` is one of - `[start|stop|restart]`. - Moreover, for a node operation, EMQX checks if node name is in our cluster and - return `404` instead of `501`. +- [#10107](https://github.com/emqx/emqx/pull/10107) For operations on Bridges API if `bridge-id` is unknown we now return `404` instead of `400`. - [#10117](https://github.com/emqx/emqx/pull/10117) Fix an error occurring when a joining node doesn't have plugins that are installed on other nodes in the cluster. - After this fix, the joining node will copy all the necessary plugins from other nodes. +After this fix, the joining node will copy all the necessary plugins from other nodes. - [#10118](https://github.com/emqx/emqx/pull/10118) Fix problems related to manual joining of EMQX replicant nodes to the cluster. - Previously, after manually executing joining and then leaving the cluster, the `replicant` node can only run normally after restarting the node after joining the cluster again. - - [Mria PR](https://github.com/emqx/mria/pull/128) - [#10119](https://github.com/emqx/emqx/pull/10119) Fix crash when `statsd.server` is set to an empty string. - [#10124](https://github.com/emqx/emqx/pull/10124) The default heartbeat period for MongoDB has been increased to reduce the risk of too excessive logging to the MongoDB log file. - [#10130](https://github.com/emqx/emqx/pull/10130) Fix garbled config display in dashboard when the value is originally from environment variables. - For example, `env EMQX_STATSD__SERVER='127.0.0.1:8124' . /bin/emqx start` results in unreadable string (not '127.0.0.1:8124') displayed in Dashboard's Statsd settings page. - Related PR: [HOCON#234](https://github.com/emqx/hocon/pull/234). -- [#10132](https://github.com/emqx/emqx/pull/10132) Fix some error logs generated by `systemctl stop emqx` command. - Prior to the fix, the command was not stopping jq and os_mon applications properly. +- [#10132](https://github.com/emqx/emqx/pull/10132) Fix some error logs generated by `systemctl stop emqx` command. +Prior to the fix, the command was not stopping `jq` and `os_mon` applications properly. -- [#10144](https://github.com/emqx/emqx/pull/10144) Add `-setcookie` emulator flag when invoking `emqx ctl` to prevent problems with emqx cli when home directory is read only. Fixes [#10142](https://github.com/emqx/emqx/issues/10142). +- [#10144](https://github.com/emqx/emqx/pull/10144) Fix an issue where emqx cli failed to set the Erlang cookie when the emqx directory was read-only. -- [#10154](https://github.com/emqx/emqx/pull/10154) Change the default `resume_interval` for bridges and connectors to be - the minimum of `health_check_interval` and `request_timeout / 3`. - Also exposes it as a hidden configuration to allow fine tuning. +- [#10154](https://github.com/emqx/emqx/pull/10154) Change the default `resume_interval` for bridges and connectors to be the minimum of `health_check_interval` and `request_timeout / 3` to resolve issue of request timeout. - Before this change, the default values for `resume_interval` meant - that, if a buffer ever got blocked due to resource errors or high - message volumes, then, by the time the buffer would try to resume its - normal operations, almost all requests would have timed out. - -- [#10157](https://github.com/emqx/emqx/pull/10157) Fixed default rate limit configuration not being applied correctly when creating a new listener. +- [#10157](https://github.com/emqx/emqx/pull/10157) Fix default rate limit configuration not being applied correctly when creating a new listener. - [#10237](https://github.com/emqx/emqx/pull/10237) Ensure we return `404` status code for unknown node names in `/nodes/:node[/metrics|/stats]` API. -- [#10251](https://github.com/emqx/emqx/pull/10251) Consider bridges referenced in `FROM` rule clauses as dependencies. - - Before this fix, when one tried to delete an ingress rule referenced in an action like `select * from "$bridges/mqtt:ingress"`, the UI would not trigger a warning about dependent rule actions. +- [#10251](https://github.com/emqx/emqx/pull/10251) Fix an issue where rule dependencies were not prompted when deleting an ingress-type bridge in use. - [#10313](https://github.com/emqx/emqx/pull/10313) Ensure that when the core or replicant node starting, the `cluster-override.conf` file is only copied from the core node. - Previously, when sorting nodes by startup time, the core node may have copied this file from the replicant node. -- [#10314](https://github.com/emqx/emqx/pull/10314) Fix /monitor_current API so that it only looks at the current node. - Fix /stats API to not crash when one or more nodes in the cluster are down. +- [#10327](https://github.com/emqx/emqx/pull/10327) Don't increase “actions.failed.unknown” rule metrics counter upon receiving unrecoverable data bridge errors. -- [#10327](https://github.com/emqx/emqx/pull/10327) Don't increment 'actions.failed.unknown' rule metrics counter upon receiving unrecoverable bridge errors. - This counter is displayed on the dashboard's rule overview tab ('Action statistics' - 'Unknown'). - The fix is only applicable for synchronous bridges, as all rule actions for asynchronous bridges - are counted as successful (they increment 'actions.success' which is displayed as 'Action statistics' - 'Success'). - -- [#10095](https://github.com/emqx/emqx/pull/10095) Stop MySQL client from bombarding server repeatedly with unnecessary `PREPARE` queries on every batch, trashing the server and exhausting its internal limits. This was happening when the MySQL bridge was in the batch mode. - - Ensure safer and more careful escaping of strings and binaries in batch insert queries when the MySQL bridge is in the batch mode. +- [#10095](https://github.com/emqx/emqx/pull/10095) Fix an issue where when the MySQL connector was in batch mode, clients would keep querying the server with unnecessary `PREPARE` statements on each batch, possibly causing server resource exhaustion. diff --git a/changes/e5.0.2.zh.md b/changes/e5.0.2.zh.md index a73372570..f6dcc3e72 100644 --- a/changes/e5.0.2.zh.md +++ b/changes/e5.0.2.zh.md @@ -1,118 +1,79 @@ # e5.0.2 -## 增强 +## 优化 -- [#10022](https://github.com/emqx/emqx/pull/10022) 开始发布Rocky Linux 9(与Enterprise Linux 9兼容)和 MacOS 12 软件包。 +- [#10022](https://github.com/emqx/emqx/pull/10022) 发布 Rocky Linux 9 (兼容Red Hat Enterprise Linux 9) 以及 macOS 12 Intel 平台的安装包。 -- [#10139](https://github.com/emqx/emqx/pull/10139) 将 `extraVolumeMounts` 添加到 EMQX Helm Chart 中,它将能够挂载用户自己的文件到 EMQX 实例中,例如在 [#9052](https://github.com/emqx/emqx/issues/9052) 中提到的 ACL 规则文件。 - 修复了 issue [#10116](https://github.com/emqx/emqx/issues/10116) +- [#10139](https://github.com/emqx/emqx/pull/10139) 在 EMQX Helm Chart 中添加 `extraVolumeMounts`,可以挂载用户自己的文件到 EMQX 实例中,例如在 [#9052](https://github.com/emqx/emqx/issues/9052) 中提到的 ACL 规则文件。 -- [#9893](https://github.com/emqx/emqx/pull/9893) 当使用 `clean_start=false` 标志连接时,EMQX 将会从消息队列中过滤出被封禁客户端发出的消息,使它们不能被下发给订阅者。 - 此前被封禁客户端发出的消息仍可能在这一场景下被下发给订阅者。 +- [#9893](https://github.com/emqx/emqx/pull/9893) 当使用 `clean_start=false` 标志连接时,EMQX 将过滤掉会话中被被黑名单功能禁止的客户端发布的消息。以前,在这种情况下,被黑名单功能禁止的客户端发送的消息仍可能被传递给订阅者。 -- [#9986](https://github.com/emqx/emqx/pull/9986) 在 helm chart 中新增了 MQTT 桥接 ingress 的配置参数;并删除了旧版本遗留的 `mgmt` 配置。 +- [#9986](https://github.com/emqx/emqx/pull/9986) 在 helm charts 中增加 MQTT ingress 并删除过时的 `mgmt` 引用。 -- [#10083](https://github.com/emqx/emqx/pull/10083) 为数据桥接增加 `DynamoDB` 支持。 +- [#9564](https://github.com/emqx/emqx/pull/9564) 数据桥接新增 Kafka Consumer,支持从 Kafka 消费消息并将它们发布到 MQTT 主题。 -- [#9564](https://github.com/emqx/emqx/pull/9564) 实现了 Kafka 消费者桥接。 - 现在可以从 Kafka 消费消息并将其发布到 MQTT 主题。 +- [#9881](https://github.com/emqx/emqx/pull/9881) 改进了与 InfluxDB 连接的健康检查相关的错误日志。 -- [#9881](https://github.com/emqx/emqx/pull/9881) 增强了与 InfluxDB 连接健康检查相关的错误日志。 - 在此更改之前,如果使用配置的参数 InfluxDB 未能通过健康检查,用户仅能获得一个“超时”的信息。 - 现在,详细的错误消息将显示在日志和控制台,从而让用户更容易地识别和解决问题。 +- [#10123](https://github.com/emqx/emqx/pull/10123) 改进了 `/bridges` API 的性能。避免了当集群节点数量较多时可能出现的请求响应超时。 -- [#10123](https://github.com/emqx/emqx/pull/10123) 改进 `/bridges` API 的性能。 - 此前,当集群中节点数目较多或节点忙时,该 API 可能出现请求超时的情况。 +- [#9998](https://github.com/emqx/emqx/pull/9998) 出于安全原因,在使用 HTTP 服务进行客户端认证时,对错误日志中的请求体进行脱敏处理。 -- [#9998](https://github.com/emqx/emqx/pull/9998) 出于安全原因,在身份验证错误日志中模糊 HTTP 请求正文。 +- [#10026](https://github.com/emqx/emqx/pull/10026) 仅在 `/bridges/:id/metrics` API 中返回指标数据。 + +- [#10052](https://github.com/emqx/emqx/pull/10052) 改进守护进程模式下启动失败后的日志。 ## 修复 -- [#10013](https://github.com/emqx/emqx/pull/10013) 修复 API `/gateways/:name/clients` 返回值的类型结构错误。 +- [#10013](https://github.com/emqx/emqx/pull/10013) 修复 `/gateways/:name/clients` API 在错误情况下的返回类型结构。 -- [#10014](https://github.com/emqx/emqx/pull/10014) 如果 API 查询的节点不存在,将会返回 `404` 而不再是 `400`。 +- [#10014](https://github.com/emqx/emqx/pull/10014) 当节点不存在时,`/monitor(_current)/nodes/:node` API 返回 `404` 错误代码而不是 `400` 。 -- [#10026](https://github.com/emqx/emqx/pull/10026) 现在只有显式调用 `/bridges/:id/metrics` 接口时才可以获得指标数据,而其他 API 接口将不再返回相关数据。 +- [#10027](https://github.com/emqx/emqx/pull/10027) 允许在 Docker 中通过 `EMQX_NODE__NAME` 设置节点名称。 -- [#10027](https://github.com/emqx/emqx/pull/10027) 在 docker 中启动时,允许使用 `EMQX_NODE__NAME` 环境变量来配置节点名。 - 在此修复前,只能使 `EMQX_NODE_NAME`。 +- [#10050](https://github.com/emqx/emqx/pull/10050) 当调用 Bridge API 时若资源不能存在则返回 `404` 状态码。 -- [#10050](https://github.com/emqx/emqx/pull/10050) 确保 Bridge API 对不存在的资源一致返回 `404` 状态代码。 +- [#10055](https://github.com/emqx/emqx/pull/10055) 修复配置项 `mqtt.max_awaiting_rel` 设置无效的问题。 -- [#10052](https://github.com/emqx/emqx/pull/10052) 优化 EMQX daemon 模式启动启动失败的日志。 +- [#10056](https://github.com/emqx/emqx/pull/10056) 修复 `/bridges` API 状态码返回错误。当被删除的 Bridge 存在依赖,或 Bridge 未启用时进行启用、停止、重启等操作时返回 `400` 状态码。 - 在进行此更改之前,当 EMQX 用 `start` 命令启动失败时,用户很难理解出错的原因。 - 所知道的仅仅是节点未能在预期时间内启动,然后被指示以 `console` 式引导节点以获取一些日志。 - 然而,节点实际上可能正在运行,这可能会导致 `console` 模式因不同的原因而失败。 +- [#10066](https://github.com/emqx/emqx/pull/10066) 优化 `/briges_probe` 和 `[/node/:node]/bridges/:id/:operation` API 调用的错误消息,使其更易理解。并修正错误状态码为`400`。 - 此次修复后,启动脚本会发出诊断: +- [#10074](https://github.com/emqx/emqx/pull/10074) 增加 `PUT /authorization/sources/:type` 请求参数 `type` 的值与请求体中的实际类型的一致性检查。 - * 如果无法从 `ps -ef` 中找到节点,则指示用户在 `erlang.log.*` 中查找信息。 - * 如果发现节点正在运行但不响应 ping,则建议用户检查节点主机名是否有效并可达。 - * 如果节点响应 ping 但 EMQX 应用程序未运行,则很可能是一个错误。在这种情况下,建议用户报告一个Github issue。 +- [#10079](https://github.com/emqx/emqx/pull/10079) 修复文档中关于 `shared_subscription_strategy` 的描述错误。 -- [#10055](https://github.com/emqx/emqx/pull/10055) 修复配置项 `mqtt.max_awaiting_rel` 更新不生效问题。 +- [#10085](https://github.com/emqx/emqx/pull/10085) 对于 `/authorization/sources/:source[/*]` API 中不存在的资源的所有请求,始终返回 `404`。 -- [#10056](https://github.com/emqx/emqx/pull/10056) 修复 `/bridges` API 的 HTTP 状态码。 - - 当删除被活动中的规则依赖的数据桥接时,将返回 `400` 而不是 `403` 。 - - 当数据桥接未启用时,调用操作(启动|停止|重启)将返回 `400` 而不是 `403`。 +- [#10098](https://github.com/emqx/emqx/pull/10098) 修复了当配置 MongoDB 授权时 MongoDB 连接器崩溃的问题。 -- [#10066](https://github.com/emqx/emqx/pull/10066) 改进 `/briges_probe` 和 `[/node/:node]/bridges/:id/:operation` API 调用的错误信息,使之更加易读。并将 HTTP 状态代码设置为 `400` 而不是 `500`。 +- [#10100](https://github.com/emqx/emqx/pull/10100) 修复了当客户端使用增强认证时,认证消息发送缓慢或者消息丢失时客户端进程崩溃的问题。 -- [#10074](https://github.com/emqx/emqx/pull/10074) 检查 `PUT /authorization/sources/:type` 中的类型是否与请求正文中的 `type` 相符。 +- [#10107](https://github.com/emqx/emqx/pull/10107) 当调用 `bridges API` 时如果 `bridge-id` 不存在则返回 `404` 状态码。 -- [#10079](https://github.com/emqx/emqx/pull/10079) 修正对 `shared_subscription_strategy` 的描述。 +- [#10117](https://github.com/emqx/emqx/pull/10117) 修复当加入的节点没有安装在集群其他节点上的插件时发生的错误。修复后,加入的节点将从其他节点复制所有必要的插件。 +- [#10118](https://github.com/emqx/emqx/pull/10118) 修复手动添加 EMQX 副本类型节点到集群的相关问题。 -- [#10085](https://github.com/emqx/emqx/pull/10085) 如果向 `/authorization/sources/:source[/*]` 请求的 `source` 不存在,将一致地返回 `404`。 +- [#10119](https://github.com/emqx/emqx/pull/10119) 修复了当 `statsd.server` 设置为空字符串时会崩溃的问题。 -- [#10098](https://github.com/emqx/emqx/pull/10098) 当 MongoDB 授权模块查询数据库时,在日志文件中发生的崩溃与错误已经被修复。 +- [#10124](https://github.com/emqx/emqx/pull/10124) 调整 MongoDB 的默认心跳周期,以降低日志文件记录过多的风险。 -- [#10100](https://github.com/emqx/emqx/pull/10100) 修复响应较慢的客户端在使用增强认证时可能出现崩溃的问题。 - 此前,当客户端使用增强认证功能,但发送 Auth 报文较慢或 Auth 报文丢失时会导致客户端进程崩溃。 +- [#10130](https://github.com/emqx/emqx/pull/10130) 修复了通过环境变量设置的值,在 Dashboard 中显示乱码的问题。 -- [#10107](https://github.com/emqx/emqx/pull/10107) 现在对桥接的 API 进行调用时,如果 `bridge-id` 不存在,将会返回 `404`,而不再是`400`。 - 然后,还修复了这种情况下,在节点级别上进行 API 调用时,可能导致崩溃的问题。 - 另外,在启动某个桥接时,会先检查指定桥接是否已启用。 - 受影响的接口有: - * [cluster] `/bridges/:id/:operation`, - * [node] `/nodes/:node/bridges/:id/:operation`, - 其中 `operation` 是 `[start|stop|restart]` 之一。 - 此外,对于节点操作,EMQX 将检查节点是否存在于集群中,如果不在,则会返回`404`,而不再是`501`。 +- [#10132](https://github.com/emqx/emqx/pull/10132) 修复了 `systemctl stop emqx` 命令无法正确停止 `jq` 和 `os_mon` 应用的问题。 -- [#10117](https://github.com/emqx/emqx/pull/10117) 修复节点加入集群时,由于缺少集其它节点已安装的插件所导致的错误。 - 在此修复后,加入集群的节点将从其它节点复制所有必须的插件。 +- [#10144](https://github.com/emqx/emqx/pull/10144) 修复了当 emqx 目录只读时, emqx cli 设置 Erlang cookie 失败的问题。 -- [#10118](https://github.com/emqx/emqx/pull/10118) 修复 `replicant` 节点因为手动加入 EMQX 集群导致的相关问题。 - 此前,手动执行 `加入集群-离开集群` 后,`replicant` 节点再次加入集群后只有重启节点才能正常运行。 +- [#10154](https://github.com/emqx/emqx/pull/10154) 将数据桥接和连接器的 `resume_interval` 参数值设为 `health_check_interval` 和 `request_timeout / 3` 中的较小值,以解决请求超时的问题。 - [Mria PR](https://github.com/emqx/mria/pull/128) +- [#10157](https://github.com/emqx/emqx/pull/10157) 修复在创建新的监听器时默认速率限制不生效的问题。 -- [#10119](https://github.com/emqx/emqx/pull/10119) 修复 `statsd.server` 配置为空字符串时启动崩溃的问题。 - -- [#10124](https://github.com/emqx/emqx/pull/10124) 增加了 MongoDB 的默认心跳周期,以减少 MongoDB 日志文件记录过多的风险。 - -- [#10130](https://github.com/emqx/emqx/pull/10130) 修复通过环境变量配置启动的 EMQX 节点无法通过HTTP API获取到正确的配置信息。 - 比如:`EMQX_STATSD__SERVER='127.0.0.1:8124' ./bin/emqx start` 后通过 Dashboard看到的 Statsd 配置信息是乱码。 - 相关 PR: [HOCON:234](https://github.com/emqx/hocon/pull/234). - -- [#10132](https://github.com/emqx/emqx/pull/10132) 修复 `systemctl stop emqx` 命令没有正常停止 jq、os_mon 组件所产生一些错误日志。 - -- [#10144](https://github.com/emqx/emqx/pull/10144) 为 emqx 可执行文件加入 `-setcookie` 标志,以避免由于 home 目录只读,导致 emqx cli 所提供的 `emqx ctl` 等命令在执行时出现的一些问题。修复 [#10142](https://github.com/emqx/emqx/issues/10142)。 - -- [#10154](https://github.com/emqx/emqx/pull/10154) 将数据桥接和连接器的 resume_interval 参数值设为 health_check_interval 和 request_timeout / 3 中的较小值,以解决请求超时的问题。 - -- [#10157](https://github.com/emqx/emqx/pull/10157) 修复在创建新的监听器时,没有正确应用速率限制默认配置的问题。 - -- [#10237](https://github.com/emqx/emqx/pull/10237) 当调用 `/nodes/:node[/metrics|/stats]` API ,若节点不存在则返回 `404` 状态码。 +- [#10237](https://github.com/emqx/emqx/pull/10237) 当调用 `/nodes/:node[/metrics|/stats]` API,若节点不存在则返回 `404` 状态码。 - [#10251](https://github.com/emqx/emqx/pull/10251) 修复了当删除一个使用中的 ingress 类型的桥接时,未提示存在规则依赖的问题。 -- [#10313](https://github.com/emqx/emqx/pull/10313) 确保当 core 或 replicant 节点启动时,仅从 core 节点复制 `cluster-override.conf` 文件。 - 此前按照节点启动时间排序时,core 节点可能从 replicant 节点复制该文件。 +- [#10313](https://github.com/emqx/emqx/pull/10313) 确保在核心节点或副本节点启动时,仅从核心节点复制 `cluster-override.conf` 文件。 -- [#10314](https://github.com/emqx/emqx/pull/10314) 修复 `/monitor_current` API ,使其仅查看当前 节点。修复了 `/stats` API,以防止当集群中的一个或多个节点关闭时出现崩溃。 +- [#10327](https://github.com/emqx/emqx/pull/10327) 数据桥接出现不可恢复的错误不再计入到 `actions.failed.unknown` 指标中。 -- [#10327](https://github.com/emqx/emqx/pull/10327) 在收到不可恢复的错误时,不要增加 'actions.failed.unknown' 规则指标计数。 - -- [#10095](https://github.com/emqx/emqx/pull/10095) 优化 MySQL 桥接在批量模式下能更高效的使用预处理语句 ,减少了对 MySQL 服务器的写入压力, 并确保对 SQL 语句进行更安全和谨慎的转义。 +- [#10095](https://github.com/emqx/emqx/pull/10095) 修复当 MySQL 连接器处于批处理模式时,会发生客户端在每个批次上不断使用不必要的 `PREPARE` 语句查询服务器,可能会导致服务器资源耗尽的问题。