From 70b6397adae858365a5e6d911d539b05a4537997 Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Thu, 24 Nov 2022 20:10:37 +0800 Subject: [PATCH 1/4] feat: support node.global_gc_interval=disabled --- apps/emqx_conf/i18n/emqx_conf_schema.conf | 4 ++-- apps/emqx_conf/src/emqx_conf_schema.erl | 2 +- apps/emqx_conf/test/emqx_global_gc_SUITE.erl | 6 +++++- apps/emqx_machine/src/emqx_global_gc.erl | 6 +++--- changes/v5.0.11-en.md | 2 ++ changes/v5.0.11-zh.md | 2 ++ 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/emqx_conf/i18n/emqx_conf_schema.conf b/apps/emqx_conf/i18n/emqx_conf_schema.conf index fc33589ec..6123b313f 100644 --- a/apps/emqx_conf/i18n/emqx_conf_schema.conf +++ b/apps/emqx_conf/i18n/emqx_conf_schema.conf @@ -471,8 +471,8 @@ significant: later configuration files override the previous ones. node_global_gc_interval { desc { - en: """Periodic garbage collection interval.""" - zh: """系统调优参数,设置节点运行多久强制进行一次全局垃圾回收。""" + en: """Periodic garbage collection interval. Set to disabled if not enabled.""" + zh: """系统调优参数,设置节点运行多久强制进行一次全局垃圾回收。禁用设置为 disabled。""" } label { en: "Global GC Interval" diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index a68c11dc4..2080d32cb 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -468,7 +468,7 @@ fields("node") -> )}, {"global_gc_interval", sc( - emqx_schema:duration(), + hoconsc:union([disabled, emqx_schema:duration()]), #{ mapping => "emqx_machine.global_gc_interval", default => "15m", diff --git a/apps/emqx_conf/test/emqx_global_gc_SUITE.erl b/apps/emqx_conf/test/emqx_global_gc_SUITE.erl index 121e12eba..9e4a5ffa6 100644 --- a/apps/emqx_conf/test/emqx_global_gc_SUITE.erl +++ b/apps/emqx_conf/test/emqx_global_gc_SUITE.erl @@ -29,4 +29,8 @@ t_run_gc(_) -> ok = timer:sleep(1500), {ok, MilliSecs} = emqx_global_gc:run(), ct:print("Global GC: ~w(ms)~n", [MilliSecs]), - emqx_global_gc:stop(). + emqx_global_gc:stop(), + ok = emqx_config:put([node, global_gc_interval], disabled), + {ok, Pid} = emqx_global_gc:start_link(), + ?assertMatch(#{timer := undefined}, sys:get_state(Pid)), + ok. diff --git a/apps/emqx_machine/src/emqx_global_gc.erl b/apps/emqx_machine/src/emqx_global_gc.erl index 74825c321..a704d603c 100644 --- a/apps/emqx_machine/src/emqx_global_gc.erl +++ b/apps/emqx_machine/src/emqx_global_gc.erl @@ -82,10 +82,10 @@ code_change(_OldVsn, State, _Extra) -> %%-------------------------------------------------------------------- ensure_timer(State) -> - case application:get_env(emqx_machine, global_gc_interval) of - undefined -> + case application:get_env(emqx_machine, global_gc_interval, disabled) of + disabled -> State; - {ok, Interval} -> + Interval when is_integer(Interval) -> TRef = emqx_misc:start_timer(Interval, run), State#{timer := TRef} end. diff --git a/changes/v5.0.11-en.md b/changes/v5.0.11-en.md index e53c5785e..ee00370fd 100644 --- a/changes/v5.0.11-en.md +++ b/changes/v5.0.11-en.md @@ -23,6 +23,8 @@ - Keep MQTT v5 User-Property pairs from bridge ingested MQTT messsages to bridge target [#9398](https://github.com/emqx/emqx/pull/9398). +- Disable global garbage collection by `node.global_gc_interval = disabled` [#9418](https://github.com/emqx/emqx/pull/9418)。 + ## Bug fixes - Fix `ssl.existingName` option of helm chart not working [#9307](https://github.com/emqx/emqx/issues/9307). diff --git a/changes/v5.0.11-zh.md b/changes/v5.0.11-zh.md index 3ea516dad..328c17467 100644 --- a/changes/v5.0.11-zh.md +++ b/changes/v5.0.11-zh.md @@ -21,6 +21,8 @@ - 为桥接收到的 MQTT v5 消息再转发时保留 User-Property 列表 [#9398](https://github.com/emqx/emqx/pull/9398)。 +- 通过 `node.global_gc_interval = disabled` 来禁用全局垃圾回收 [#9418](https://github.com/emqx/emqx/pull/9418)。 + ## 修复 - 修复 helm chart 的 `ssl.existingName` 选项不起作用 [#9307](https://github.com/emqx/emqx/issues/9307)。 From 59ac5320b1da00dfdc62521b5b14a299d3cb6ef3 Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Thu, 24 Nov 2022 20:38:11 +0800 Subject: [PATCH 2/4] chore: update emqx_conf/emqx_machine version --- apps/emqx_conf/src/emqx_conf.app.src | 2 +- apps/emqx_machine/src/emqx_machine.app.src | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/emqx_conf/src/emqx_conf.app.src b/apps/emqx_conf/src/emqx_conf.app.src index 2b6efe639..c57664ca7 100644 --- a/apps/emqx_conf/src/emqx_conf.app.src +++ b/apps/emqx_conf/src/emqx_conf.app.src @@ -1,6 +1,6 @@ {application, emqx_conf, [ {description, "EMQX configuration management"}, - {vsn, "0.1.6"}, + {vsn, "0.1.7"}, {registered, []}, {mod, {emqx_conf_app, []}}, {applications, [kernel, stdlib]}, diff --git a/apps/emqx_machine/src/emqx_machine.app.src b/apps/emqx_machine/src/emqx_machine.app.src index 59a5ad4b8..63c6c01ad 100644 --- a/apps/emqx_machine/src/emqx_machine.app.src +++ b/apps/emqx_machine/src/emqx_machine.app.src @@ -3,7 +3,7 @@ {id, "emqx_machine"}, {description, "The EMQX Machine"}, % strict semver, bump manually! - {vsn, "0.1.0"}, + {vsn, "0.1.1"}, {modules, []}, {registered, []}, {applications, [kernel, stdlib]}, From e4ec72ae9eff2c329e43838e17ca49b1ae73feb5 Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Fri, 25 Nov 2022 07:33:36 +0800 Subject: [PATCH 3/4] chore: update v5.0.12 changelog --- changes/v5.0.11-en.md | 2 -- changes/v5.0.11-zh.md | 2 -- changes/v5.0.12-en.md | 2 ++ changes/v5.0.12-zh.md | 2 ++ 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/changes/v5.0.11-en.md b/changes/v5.0.11-en.md index ee00370fd..e53c5785e 100644 --- a/changes/v5.0.11-en.md +++ b/changes/v5.0.11-en.md @@ -23,8 +23,6 @@ - Keep MQTT v5 User-Property pairs from bridge ingested MQTT messsages to bridge target [#9398](https://github.com/emqx/emqx/pull/9398). -- Disable global garbage collection by `node.global_gc_interval = disabled` [#9418](https://github.com/emqx/emqx/pull/9418)。 - ## Bug fixes - Fix `ssl.existingName` option of helm chart not working [#9307](https://github.com/emqx/emqx/issues/9307). diff --git a/changes/v5.0.11-zh.md b/changes/v5.0.11-zh.md index 328c17467..3ea516dad 100644 --- a/changes/v5.0.11-zh.md +++ b/changes/v5.0.11-zh.md @@ -21,8 +21,6 @@ - 为桥接收到的 MQTT v5 消息再转发时保留 User-Property 列表 [#9398](https://github.com/emqx/emqx/pull/9398)。 -- 通过 `node.global_gc_interval = disabled` 来禁用全局垃圾回收 [#9418](https://github.com/emqx/emqx/pull/9418)。 - ## 修复 - 修复 helm chart 的 `ssl.existingName` 选项不起作用 [#9307](https://github.com/emqx/emqx/issues/9307)。 diff --git a/changes/v5.0.12-en.md b/changes/v5.0.12-en.md index 52af23519..f61778840 100644 --- a/changes/v5.0.12-en.md +++ b/changes/v5.0.12-en.md @@ -2,4 +2,6 @@ ## Enhancements +- Disable global garbage collection by `node.global_gc_interval = disabled` [#9418](https://github.com/emqx/emqx/pull/9418)。 + ## Bug fixes diff --git a/changes/v5.0.12-zh.md b/changes/v5.0.12-zh.md index 49f479a1e..41507fe23 100644 --- a/changes/v5.0.12-zh.md +++ b/changes/v5.0.12-zh.md @@ -2,4 +2,6 @@ ## 增强 +- 通过 `node.global_gc_interval = disabled` 来禁用全局垃圾回收 [#9418](https://github.com/emqx/emqx/pull/9418)。 + ## 修复 From 28bede0377427e68b864cc63023efacdd288e372 Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Fri, 25 Nov 2022 16:38:40 +0800 Subject: [PATCH 4/4] chore: update i18n en description --- apps/emqx_conf/i18n/emqx_conf_schema.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx_conf/i18n/emqx_conf_schema.conf b/apps/emqx_conf/i18n/emqx_conf_schema.conf index 6123b313f..337823233 100644 --- a/apps/emqx_conf/i18n/emqx_conf_schema.conf +++ b/apps/emqx_conf/i18n/emqx_conf_schema.conf @@ -471,7 +471,7 @@ significant: later configuration files override the previous ones. node_global_gc_interval { desc { - en: """Periodic garbage collection interval. Set to disabled if not enabled.""" + en: """Periodic garbage collection interval. Set to disabled to have it disabled.""" zh: """系统调优参数,设置节点运行多久强制进行一次全局垃圾回收。禁用设置为 disabled。""" } label {