Преглед изворни кода

fix: cannot import retained messages

Shawn пре 1 година
родитељ
комит
9d1a69aaa9

+ 2 - 2
apps/emqx_bridge/src/emqx_bridge_v2.erl

@@ -1036,9 +1036,9 @@ import_config(RawConf) ->
     SourceRes = emqx_bridge:import_config(
         RawConf, <<"sources">>, ?ROOT_KEY_SOURCES, config_key_path_sources()
     ),
-    combine_import_results([ActionRes, SourceRes]).
+    group_import_results([ActionRes, SourceRes]).
 
-combine_import_results(Results0) ->
+group_import_results(Results0) ->
     Results = lists:foldr(
         fun
             ({ok, OkRes}, {OkAcc, ErrAcc}) ->

+ 1 - 1
apps/emqx_retainer/src/emqx_retainer.app.src

@@ -2,7 +2,7 @@
 {application, emqx_retainer, [
     {description, "EMQX Retainer"},
     % strict semver, bump manually!
-    {vsn, "5.0.21"},
+    {vsn, "5.0.22"},
     {modules, []},
     {registered, [emqx_retainer_sup]},
     {applications, [kernel, stdlib, emqx, emqx_ctl]},

+ 9 - 0
apps/emqx_retainer/src/emqx_retainer_mnesia.erl

@@ -17,6 +17,7 @@
 -module(emqx_retainer_mnesia).
 
 -behaviour(emqx_retainer).
+-behaviour(emqx_db_backup).
 
 -include("emqx_retainer.hrl").
 -include_lib("emqx/include/logger.hrl").
@@ -54,6 +55,8 @@
 -export([populate_index_meta/0]).
 -export([reindex/3]).
 
+-export([backup_tables/0]).
+
 -record(retained_message, {topic, msg, expiry_time}).
 -record(retained_index, {key, expiry_time}).
 -record(retained_index_meta, {key, read_indices, write_indices, reindexing, extra}).
@@ -73,6 +76,12 @@
 topics() ->
     [emqx_topic:join(I) || I <- mnesia:dirty_all_keys(?TAB_MESSAGE)].
 
+%%--------------------------------------------------------------------
+%% Data backup
+%%--------------------------------------------------------------------
+backup_tables() ->
+    [?TAB_MESSAGE].
+
 %%--------------------------------------------------------------------
 %% emqx_retainer callbacks
 %%--------------------------------------------------------------------

+ 4 - 16
changes/ce/fix-12826.en.md

@@ -1,18 +1,6 @@
-Cannot import `sources` from backup files.
+Fixed an issue that prevented importing source data integrations and retained messages.
 
-Before the fix, the following configs in backup files cannot be imported:
+Before the fix:
 
-```
-sources {
-  mqtt {
-    source_c384b174 {
-      connector = source_connector_c8287217
-      enable = true
-      parameters {
-        qos = 0
-        topic = "t/#"
-      }
-    }
-  }
-}
-```
+- source data integrations are ignored from the backup file
+- importing the `mnesia` table for retained messages are not supported