From d369e3167bdd504a33765ff23ab450acc1d88aea Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Tue, 28 Feb 2023 21:20:25 +0100 Subject: [PATCH 1/8] fix(emqx_mgmt): format stoped nodes correctly --- apps/emqx_management/src/emqx_mgmt.erl | 21 ++++++++++++++- .../src/emqx_mgmt_api_nodes.erl | 27 +++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/apps/emqx_management/src/emqx_mgmt.erl b/apps/emqx_management/src/emqx_mgmt.erl index efa5a03bd..82a8b94f8 100644 --- a/apps/emqx_management/src/emqx_mgmt.erl +++ b/apps/emqx_management/src/emqx_mgmt.erl @@ -141,9 +141,28 @@ node_info() -> uptime => proplists:get_value(uptime, BrokerInfo), version => iolist_to_binary(proplists:get_value(version, BrokerInfo)), edition => emqx_release:edition_longstr(), - role => mria_rlog:role() + role => mria_rlog:role(), + log_path => log_path(), + sys_path => iolist_to_binary(code:root_dir()) }. +log_path() -> + RootDir = code:root_dir(), + Configs = logger:get_handler_config(), + case get_log_path(Configs) of + undefined -> + <<"log.file_handler.default.enable is false, not logging to file.">>; + Path -> + filename:join(RootDir, Path) + end. + +get_log_path([#{config := #{file := Path}} | _LoggerConfigs]) -> + filename:dirname(Path); +get_log_path([_LoggerConfig | LoggerConfigs]) -> + get_log_path(LoggerConfigs); +get_log_path([]) -> + undefined. + get_sys_memory() -> case os:type() of {unix, linux} -> diff --git a/apps/emqx_management/src/emqx_mgmt_api_nodes.erl b/apps/emqx_management/src/emqx_mgmt_api_nodes.erl index cb8d37609..21d905331 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_nodes.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_nodes.erl @@ -293,31 +293,12 @@ get_stats(Node) -> %% internal function format(_Node, Info = #{memory_total := Total, memory_used := Used}) -> - RootDir = list_to_binary(code:root_dir()), - LogPath = - case log_path() of - undefined -> - <<"log.file_handler.default.enable is false,only log to console">>; - Path -> - filename:join(RootDir, Path) - end, Info#{ memory_total := emqx_mgmt_util:kmg(Total), - memory_used := emqx_mgmt_util:kmg(Used), - sys_path => RootDir, - log_path => LogPath - }. - -log_path() -> - Configs = logger:get_handler_config(), - get_log_path(Configs). - -get_log_path([#{config := #{file := Path}} | _LoggerConfigs]) -> - filename:dirname(Path); -get_log_path([_LoggerConfig | LoggerConfigs]) -> - get_log_path(LoggerConfigs); -get_log_path([]) -> - undefined. + memory_used := emqx_mgmt_util:kmg(Used) + }; +format(_Node, Info) when is_map(Info) -> + Info. node_error() -> emqx_dashboard_swagger:error_codes([?SOURCE_ERROR], <<"Node error">>). From 8331c8fff0c6d754df303be487bf92d037519474 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Tue, 28 Feb 2023 21:40:48 +0100 Subject: [PATCH 2/8] docs: add changelogs --- changes/ce/fix-10044.en.md | 1 + changes/ce/fix-10044.zh.md | 1 + 2 files changed, 2 insertions(+) create mode 100644 changes/ce/fix-10044.en.md create mode 100644 changes/ce/fix-10044.zh.md diff --git a/changes/ce/fix-10044.en.md b/changes/ce/fix-10044.en.md new file mode 100644 index 000000000..4837d8ecc --- /dev/null +++ b/changes/ce/fix-10044.en.md @@ -0,0 +1 @@ +Fix node information formatter for stopped nodes in the cluster. diff --git a/changes/ce/fix-10044.zh.md b/changes/ce/fix-10044.zh.md new file mode 100644 index 000000000..29de963f1 --- /dev/null +++ b/changes/ce/fix-10044.zh.md @@ -0,0 +1 @@ +修复 v5.0.18 引入的一个节点信息序列化是发生的错误。 From 469071df00318eaa8f2d4a53b16408e8a0bdac45 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 1 Mar 2023 07:45:36 +0100 Subject: [PATCH 3/8] fix(emqx_management): ensure binary string for log_path --- apps/emqx_management/src/emqx_mgmt.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx_management/src/emqx_mgmt.erl b/apps/emqx_management/src/emqx_mgmt.erl index 82a8b94f8..dfe1ff310 100644 --- a/apps/emqx_management/src/emqx_mgmt.erl +++ b/apps/emqx_management/src/emqx_mgmt.erl @@ -153,7 +153,7 @@ log_path() -> undefined -> <<"log.file_handler.default.enable is false, not logging to file.">>; Path -> - filename:join(RootDir, Path) + iolist_to_binary(filename:join(RootDir, Path)) end. get_log_path([#{config := #{file := Path}} | _LoggerConfigs]) -> From 2b06089250ffa693136df535c5adafed90319b2c Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 1 Mar 2023 08:48:23 +0100 Subject: [PATCH 4/8] test: stop apps in end_per_suite --- apps/emqx/test/emqx_quic_multistreams_SUITE.erl | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/emqx/test/emqx_quic_multistreams_SUITE.erl b/apps/emqx/test/emqx_quic_multistreams_SUITE.erl index a1b7db12f..b0121314c 100644 --- a/apps/emqx/test/emqx_quic_multistreams_SUITE.erl +++ b/apps/emqx/test/emqx_quic_multistreams_SUITE.erl @@ -152,6 +152,7 @@ init_per_suite(Config) -> end_per_suite(Config) -> emqx_config:put_zone_conf(default, [force_shutdown], ?config(shutdown_policy, Config)), + emqx_common_test_helpers:stop_apps([]), ok. init_per_group(pub_qos0, Config) -> From c6161925782e7b6c29a51c7694e71997d9151dcc Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 1 Mar 2023 09:39:16 +0100 Subject: [PATCH 5/8] docs: Update changes/ce/fix-10044.zh.md Co-authored-by: William Yang --- changes/ce/fix-10044.zh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/ce/fix-10044.zh.md b/changes/ce/fix-10044.zh.md index 29de963f1..9979e0fc7 100644 --- a/changes/ce/fix-10044.zh.md +++ b/changes/ce/fix-10044.zh.md @@ -1 +1 @@ -修复 v5.0.18 引入的一个节点信息序列化是发生的错误。 +修复 v5.0.18 引入的一个节点信息序列化时发生的错误。 From 0185c81f696085d719642c9863e74b8e041e8756 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 1 Mar 2023 11:53:24 +0100 Subject: [PATCH 6/8] chore: bump opensource edition version to v5.0.19 --- apps/emqx/include/emqx_release.hrl | 2 +- deploy/charts/emqx/Chart.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/emqx/include/emqx_release.hrl b/apps/emqx/include/emqx_release.hrl index 7ad1fba20..ffaa4aa36 100644 --- a/apps/emqx/include/emqx_release.hrl +++ b/apps/emqx/include/emqx_release.hrl @@ -32,7 +32,7 @@ %% `apps/emqx/src/bpapi/README.md' %% Community edition --define(EMQX_RELEASE_CE, "5.0.18"). +-define(EMQX_RELEASE_CE, "5.0.19"). %% Enterprise edition -define(EMQX_RELEASE_EE, "5.0.1-beta.1"). diff --git a/deploy/charts/emqx/Chart.yaml b/deploy/charts/emqx/Chart.yaml index ffe6ee45a..71c2122b1 100644 --- a/deploy/charts/emqx/Chart.yaml +++ b/deploy/charts/emqx/Chart.yaml @@ -14,8 +14,8 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 5.0.18 +version: 5.0.19 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. -appVersion: 5.0.18 +appVersion: 5.0.19 From b04f7ecccf936ff3bf578dc54c7f68dc2ee9ca67 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 1 Mar 2023 11:54:15 +0100 Subject: [PATCH 7/8] chore: Generate changelog for v5.0.19 --- changes/v5.0.19.en.md | 23 +++++++++++++++++++++++ changes/v5.0.19.zh.md | 24 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 changes/v5.0.19.en.md create mode 100644 changes/v5.0.19.zh.md diff --git a/changes/v5.0.19.en.md b/changes/v5.0.19.en.md new file mode 100644 index 000000000..f8404317e --- /dev/null +++ b/changes/v5.0.19.en.md @@ -0,0 +1,23 @@ +# v5.0.19 + +## Bug Fixes + +- [#10032](https://github.com/emqx/emqx/pull/10032) When the resource manager is busy trying to establish a connection with the remote, the resource might yet lack any metrics information. Prior to this fix, the `bridges/` API handler crashed in such circumstances. + +- [#10037](https://github.com/emqx/emqx/pull/10037) Fix Swagger API doc rendering crash. + In version 5.0.18, a bug was introduced that resulted in duplicated field names in the configuration schema. This, in turn, caused the Swagger schema generated to become invalid. + +- [#10041](https://github.com/emqx/emqx/pull/10041) For influxdb bridge, added integer value placeholder annotation hint to `write_syntax` documentation. + Also supported setting a constant value for the `timestamp` field. + +- [#10042](https://github.com/emqx/emqx/pull/10042) Improve behavior of the `replicant` nodes when the `core` cluster becomes partitioned (for example when a core node leaves the cluster). + Previously, the replicant nodes were unable to rebalance connections to the core nodes, until the core cluster became whole again. + This was indicated by the error messages: `[error] line: 182, mfa: mria_lb:list_core_nodes/1, msg: mria_lb_core_discovery divergent cluster`. + + [Mria PR](https://github.com/emqx/mria/pull/123/files) + +- [#10043](https://github.com/emqx/emqx/pull/10043) Fixed two bugs introduced in v5.0.18. + * The environment varialbe `SSL_DIST_OPTFILE` was not set correctly for non-boot commands. + * When cookie is overridden from environment variable, EMQX node is unable to start. + +- [#10044](https://github.com/emqx/emqx/pull/10044) Fix node information formatter for stopped nodes in the cluster. diff --git a/changes/v5.0.19.zh.md b/changes/v5.0.19.zh.md new file mode 100644 index 000000000..065049671 --- /dev/null +++ b/changes/v5.0.19.zh.md @@ -0,0 +1,24 @@ +# v5.0.19 + +## 修复 + +- [#10032](https://github.com/emqx/emqx/pull/10032) 当资源管理器忙于尝试与远程建立连接时,资源可能还缺少任何度量信息。 在此修复之前,`bridges/' API 处理程序在这种情况下崩溃。 + +- [#10037](https://github.com/emqx/emqx/pull/10037) 修复 Swagger API 文档渲染崩溃。 + 在版本 5.0.18 中,引入了一个错误,导致配置 schema 中出现了重复的配置名称,进而导致生成了无效的 Swagger spec。 + +- [#10041](https://github.com/emqx/emqx/pull/10041) 为 influxdb 桥接的配置项 `write_syntax` 描述文档增加了类型标识符的提醒。 + 另外在配置中支持 `timestamp` 使用一个常量。 + +- [#10042](https://github.com/emqx/emqx/pull/10042) 改进 `core` 集群被分割时 `replicant`节点的行为。 + 修复前,如果 `core` 集群分裂成两个小集群(例如一个节点离开集群)时,`replicant` 节点无法重新平衡与核心节点的连接,直到核心集群再次变得完整。 + 这种个问题会导致 replicant 节点出现如下日志: + `[error] line: 182, mfa: mria_lb:list_core_nodes/1, msg: mria_lb_core_discovery divergent cluster`。 + + [Mria PR](https://github.com/emqx/mria/pull/123/files) + +- [#10043](https://github.com/emqx/emqx/pull/10043) 修复 v5.0.18 引入的 2 个bug。 + * 环境变量 `SSL_DIST_OPTFILE` 的值设置错误导致节点无法为 Erlang distribution 启用 SSL。 + * 当节点的 cookie 从环境变量重载 (而不是设置在配置文件中时),节点无法启动的问题。 + +- [#10044](https://github.com/emqx/emqx/pull/10044) 修复 v5.0.18 引入的一个节点信息序列化时发生的错误。 From a76ef2449347c1d37729cf2de80765dbc3bd08e0 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 1 Mar 2023 14:06:23 +0100 Subject: [PATCH 8/8] docs: merge missed change logs to v5.0.18 --- changes/v5.0.18.en.md | 4 +++- changes/v5.0.18.zh.md | 3 +++ changes/v5.0.18/fix-9966.en.md | 2 -- changes/v5.0.18/fix-9966.zh.md | 2 -- 4 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 changes/v5.0.18/fix-9966.en.md delete mode 100644 changes/v5.0.18/fix-9966.zh.md diff --git a/changes/v5.0.18.en.md b/changes/v5.0.18.en.md index e6694773d..15ba9ff84 100644 --- a/changes/v5.0.18.en.md +++ b/changes/v5.0.18.en.md @@ -7,7 +7,9 @@ - [#9213](https://github.com/emqx/emqx/pull/9213) Add pod disruption budget to helm chart - [#9949](https://github.com/emqx/emqx/pull/9949) QUIC transport Multistreams support and QUIC TLS cacert support. - + +- [#9966](https://github.com/emqx/emqx/pull/9966) Add two new Erlang apps 'tools' and 'covertool' to the release. + So we can run profiling and test coverage analysis on release packages. - [#9967](https://github.com/emqx/emqx/pull/9967) New common TLS option 'hibernate_after' to reduce memory footprint per idle connecion, default: 5s. diff --git a/changes/v5.0.18.zh.md b/changes/v5.0.18.zh.md index d88c823d7..e186da913 100644 --- a/changes/v5.0.18.zh.md +++ b/changes/v5.0.18.zh.md @@ -8,6 +8,9 @@ - [#9949](https://github.com/emqx/emqx/pull/9949) QUIC 传输多流支持和 QUIC TLS cacert 支持。 +- [#9966](https://github.com/emqx/emqx/pull/9966) 在发布包中增加了2个新的 Erlang app,分别是 ‘tools’ 和 ‘covertool’。 + 这两个 app 可以用于性能和测试覆盖率的分析。 + - [#9967](https://github.com/emqx/emqx/pull/9967) 新的通用 TLS 选项 'hibernate_after', 以减少空闲连接的内存占用,默认: 5s 。 ## 修复 diff --git a/changes/v5.0.18/fix-9966.en.md b/changes/v5.0.18/fix-9966.en.md deleted file mode 100644 index cc3a0bb8f..000000000 --- a/changes/v5.0.18/fix-9966.en.md +++ /dev/null @@ -1,2 +0,0 @@ -Add two new Erlang apps 'tools' and 'covertool' to the release. -So we can run profiling and test coverage analysis on release packages. diff --git a/changes/v5.0.18/fix-9966.zh.md b/changes/v5.0.18/fix-9966.zh.md deleted file mode 100644 index df5b7cff7..000000000 --- a/changes/v5.0.18/fix-9966.zh.md +++ /dev/null @@ -1,2 +0,0 @@ -在发布包中增加了2个新的 Erlang app,分别是 ‘tools’ 和 ‘covertool’。 -这两个 app 可以用于性能和测试覆盖率的分析。