fix: cannot import retained messages

This commit is contained in:
Shawn 2024-04-03 18:39:32 +08:00
parent 319ec50c0d
commit 9d1a69aaa9
4 changed files with 16 additions and 19 deletions

View File

@ -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}) ->

View File

@ -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]},

View File

@ -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
%%--------------------------------------------------------------------

View File

@ -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