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( SourceRes = emqx_bridge:import_config(
RawConf, <<"sources">>, ?ROOT_KEY_SOURCES, config_key_path_sources() 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( Results = lists:foldr(
fun fun
({ok, OkRes}, {OkAcc, ErrAcc}) -> ({ok, OkRes}, {OkAcc, ErrAcc}) ->

View File

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

View File

@ -17,6 +17,7 @@
-module(emqx_retainer_mnesia). -module(emqx_retainer_mnesia).
-behaviour(emqx_retainer). -behaviour(emqx_retainer).
-behaviour(emqx_db_backup).
-include("emqx_retainer.hrl"). -include("emqx_retainer.hrl").
-include_lib("emqx/include/logger.hrl"). -include_lib("emqx/include/logger.hrl").
@ -54,6 +55,8 @@
-export([populate_index_meta/0]). -export([populate_index_meta/0]).
-export([reindex/3]). -export([reindex/3]).
-export([backup_tables/0]).
-record(retained_message, {topic, msg, expiry_time}). -record(retained_message, {topic, msg, expiry_time}).
-record(retained_index, {key, expiry_time}). -record(retained_index, {key, expiry_time}).
-record(retained_index_meta, {key, read_indices, write_indices, reindexing, extra}). -record(retained_index_meta, {key, read_indices, write_indices, reindexing, extra}).
@ -73,6 +76,12 @@
topics() -> topics() ->
[emqx_topic:join(I) || I <- mnesia:dirty_all_keys(?TAB_MESSAGE)]. [emqx_topic:join(I) || I <- mnesia:dirty_all_keys(?TAB_MESSAGE)].
%%--------------------------------------------------------------------
%% Data backup
%%--------------------------------------------------------------------
backup_tables() ->
[?TAB_MESSAGE].
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% emqx_retainer callbacks %% 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:
``` - source data integrations are ignored from the backup file
sources { - importing the `mnesia` table for retained messages are not supported
mqtt {
source_c384b174 {
connector = source_connector_c8287217
enable = true
parameters {
qos = 0
topic = "t/#"
}
}
}
}
```