Pārlūkot izejas kodu

feat: rename emqx_relup to emqx_post_upgrade

Shawn 1 gadu atpakaļ
vecāks
revīzija
5fca0a16f9

+ 38 - 0
apps/emqx/src/emqx_post_upgrade.erl

@@ -0,0 +1,38 @@
+%%--------------------------------------------------------------------
+%% Copyright (c) 2017-2024 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_post_upgrade).
+
+%% PR#12765
+-export([
+    pr12765_update_stats_timer/1,
+    pr12765_revert_stats_timer/1
+]).
+
+-include("logger.hrl").
+
+%%------------------------------------------------------------------------------
+%% Hot Upgrade Callback Functions.
+%%------------------------------------------------------------------------------
+pr12765_update_stats_timer(_FromVsn) ->
+    emqx_stats:update_interval(broker_stats, fun emqx_broker_helper:stats_fun/0).
+
+pr12765_revert_stats_timer(_ToVsn) ->
+    emqx_stats:update_interval(broker_stats, fun emqx_broker:stats_fun/0).
+
+%%------------------------------------------------------------------------------
+%% Helper functions
+%%------------------------------------------------------------------------------

+ 0 - 42
apps/emqx/src/emqx_relup.erl

@@ -1,42 +0,0 @@
-%%--------------------------------------------------------------------
-%% Copyright (c) 2017-2024 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_relup).
-
-%% NOTE: DO NOT remove this `-include`.
-%% We use this to force this module to be upgraded every release.
--include("emqx_release.hrl").
-
--export([
-    post_release_upgrade/2,
-    post_release_downgrade/2
-]).
-
--define(INFO(FORMAT), io:format("[emqx_relup] " ++ FORMAT ++ "~n")).
--define(INFO(FORMAT, ARGS), io:format("[emqx_relup] " ++ FORMAT ++ "~n", ARGS)).
-
-%% What to do after upgraded from an old release vsn.
-post_release_upgrade(FromRelVsn, _) ->
-    ?INFO("emqx has been upgraded from ~s to ~s!", [FromRelVsn, emqx_release:version()]),
-    reload_components().
-
-%% What to do after downgraded to an old release vsn.
-post_release_downgrade(ToRelVsn, _) ->
-    ?INFO("emqx has been downgraded from ~s to ~s!", [emqx_release:version(), ToRelVsn]),
-    reload_components().
-
-reload_components() ->
-    ok.

+ 1 - 4
relup/examples/5.6.1-to-5.6.1+patch.A.relup

@@ -34,9 +34,6 @@
         , {update, emqx_ds_replication_layer_egress, {advanced, #{}}}
         ],
     post_upgrade_callbacks =>
-        [ {pr12781_init_db_metrics, pr12781_termiate_db_metrics}
-        , {pr12781_create_persist_msg_pterm, pr12781_erase_persist_msg_pterm}
-        , {pr12781_trans_tables, pr12781_revert_tables}
-        , {pr12765_update_stats_timer, pr12765_revert_stats_timer}
+        [ {pr12765_update_stats_timer, pr12765_revert_stats_timer}
         ]
 }.