feat: turn tables queried with search APIs into ordered sets

This is needed to ensure more or less consistent client experience
for the new planned cursor-based search APIs.
This commit is contained in:
Andrew Mayorov 2023-01-13 17:21:47 +03:00
parent a7fc5e8fe1
commit ce2dba15b4
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
6 changed files with 6 additions and 4 deletions

View File

@ -89,7 +89,7 @@ mnesia(boot) ->
ok = mria:create_table(
?ACTIVATED_ALARM,
[
{type, set},
{type, ordered_set},
{storage, disc_copies},
{local_content, true},
{record_name, activated_alarm},

View File

@ -107,7 +107,7 @@ create_tabs() ->
TabOpts = [public, {read_concurrency, true}, {write_concurrency, true}],
%% SubOption: {SubPid, Topic} -> SubOption
ok = emqx_tables:new(?SUBOPTION, [set | TabOpts]),
ok = emqx_tables:new(?SUBOPTION, [ordered_set | TabOpts]),
%% Subscription: SubPid -> Topic1, Topic2, Topic3, ...
%% duplicate_bag: o(1) insert

View File

@ -94,6 +94,7 @@
mnesia(boot) ->
ok = mria:create_table(?TAB, [
{rlog_shard, ?AUTH_SHARD},
{type, ordered_set},
{storage, disc_copies},
{record_name, user_info},
{attributes, record_info(fields, user_info)},

View File

@ -96,6 +96,7 @@
mnesia(boot) ->
ok = mria:create_table(?TAB, [
{rlog_shard, ?AUTH_SHARD},
{type, ordered_set},
{storage, disc_copies},
{record_name, user_info},
{attributes, record_info(fields, user_info)},

View File

@ -768,7 +768,7 @@ init(Options) ->
{ChanTab, ConnTab, InfoTab} = cmtabs(GwName),
ok = emqx_tables:new(ChanTab, [bag, {read_concurrency, true} | TabOpts]),
ok = emqx_tables:new(ConnTab, [bag | TabOpts]),
ok = emqx_tables:new(InfoTab, [set, compressed | TabOpts]),
ok = emqx_tables:new(InfoTab, [ordered_set, compressed | TabOpts]),
%% Start link cm-registry process
%% XXX: Should I hang it under a higher level supervisor?

View File

@ -25,7 +25,7 @@
-export([stop/1]).
start(_Type, _Args) ->
_ = ets:new(?RULE_TAB, [named_table, public, set, {read_concurrency, true}]),
_ = ets:new(?RULE_TAB, [named_table, public, ordered_set, {read_concurrency, true}]),
ok = emqx_rule_events:reload(),
SupRet = emqx_rule_engine_sup:start_link(),
ok = emqx_rule_engine:load_rules(),