fix(emqx_retainer): remove disc_only option
This commit is contained in:
parent
126924bc54
commit
aacdc5c2f7
|
@ -13,10 +13,9 @@ etc/emqx_retainer.conf:
|
|||
## Where to store the retained messages.
|
||||
## Notice that all nodes in a cluster are to have the same storage_type.
|
||||
##
|
||||
## Value: ram | disc | disc_only
|
||||
## Value: ram | disc
|
||||
## - ram: memory only
|
||||
## - disc: both memory and disc
|
||||
## - disc_only: disc only
|
||||
##
|
||||
## Default: ram
|
||||
retainer.storage_type = ram
|
||||
|
@ -56,4 +55,3 @@ Author
|
|||
------
|
||||
|
||||
EMQ X Team
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ emqx_retainer {
|
|||
|
||||
type = built_in_database
|
||||
|
||||
## storage_type: ram | disc | disc_only
|
||||
## storage_type: ram | disc
|
||||
storage_type = ram
|
||||
|
||||
## Maximum number of retained messages. 0 means no limit.
|
||||
|
|
|
@ -45,24 +45,22 @@
|
|||
create_resource(#{storage_type := StorageType}) ->
|
||||
Copies = case StorageType of
|
||||
ram -> ram_copies;
|
||||
disc -> disc_copies;
|
||||
disc_only -> disc_only_copies
|
||||
disc -> disc_copies
|
||||
end,
|
||||
TableType = case StorageType of
|
||||
disc_only -> set;
|
||||
_ -> ordered_set
|
||||
end,
|
||||
|
||||
StoreProps = [{ets, [compressed,
|
||||
{read_concurrency, true},
|
||||
{write_concurrency, true}]},
|
||||
{dets, [{auto_save, 1000}]}],
|
||||
|
||||
ok = mria:create_table(?TAB, [
|
||||
{type, TableType},
|
||||
{rlog_shard, ?RETAINER_SHARD},
|
||||
{storage, Copies},
|
||||
{record_name, retained},
|
||||
{attributes, record_info(fields, retained)},
|
||||
{storage_properties, StoreProps}]),
|
||||
{type, ordered_set},
|
||||
{rlog_shard, ?RETAINER_SHARD},
|
||||
{storage, Copies},
|
||||
{record_name, retained},
|
||||
{attributes, record_info(fields, retained)},
|
||||
{storage_properties, StoreProps}
|
||||
]),
|
||||
ok = mria_rlog:wait_for_shards([?RETAINER_SHARD], infinity),
|
||||
case mnesia:table_info(?TAB, storage_type) of
|
||||
Copies -> ok;
|
||||
|
|
|
@ -20,7 +20,7 @@ fields("emqx_retainer") ->
|
|||
|
||||
fields(mnesia_config) ->
|
||||
[ {type, ?TYPE(hoconsc:union([built_in_database]))}
|
||||
, {storage_type, sc(hoconsc:union([ram, disc, disc_only]), ram)}
|
||||
, {storage_type, sc(hoconsc:union([ram, disc]), ram)}
|
||||
, {max_retained_messages, sc(integer(), 0, fun is_pos_integer/1)}
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue