chore(gw): rename cm-registry shard name

This commit is contained in:
JianBo He 2021-10-22 10:25:00 +08:00 committed by JianBo He
parent c05ecdbcb8
commit cf17a55079
2 changed files with 2 additions and 25 deletions

View File

@ -19,12 +19,8 @@
-behaviour(gen_server).
-export([start_link/1]).
%% XXX: needless
%-export([is_enabled/0]).
-export([ register_channel/2
, unregister_channel/2
]).
@ -40,8 +36,7 @@
, code_change/3
]).
-include_lib("emqx/include/emqx.hrl").
-define(CM_SHARD, emqx_gateway_cm_shard).
-define(LOCK, {?MODULE, cleanup_down}).
-record(channel, {chid, pid}).
@ -113,8 +108,7 @@ handle_info({membership, {mnesia, down, Node}}, State = #{type := Type}) ->
Tab = tabname(Type),
global:trans({?LOCK, self()},
fun() ->
%% FIXME: The shard name should be fixed later
mria:transaction(?MODULE, fun cleanup_channels/2, [Node, Tab])
mria:transaction(?CM_SHARD, fun cleanup_channels/2, [Node, Tab])
end),
{noreply, State};

View File

@ -52,21 +52,6 @@
-record(emqx_sn_registry, {key, value}).
%% Mnesia bootstrap
%-export([mnesia/1]).
%-boot_mnesia({mnesia, [boot]}).
%%% @doc Create or replicate tables.
%-spec(mnesia(boot | copy) -> ok).
%mnesia(boot) ->
% %% Optimize storage
% StoreProps = [{ets, [{read_concurrency, true}]}],
% ok = mria:create_table(?MODULE, [
% {attributes, record_info(fields, emqx_sn_registry)},
% {ram_copies, [node()]},
% {storage_properties, StoreProps}]).
-type registry() :: {Tab :: atom(),
RegistryPid :: pid()}.
@ -145,8 +130,6 @@ init([InstaId, PredefTopics]) ->
{rlog_shard, ?SN_SHARD}
]),
ok = mria:wait_for_tables([Tab]),
% FIXME:
%ok = mria_rlog:wait_for_shards([?CM_SHARD], infinity),
MaxPredefId = lists:foldl(
fun(#{id := TopicId, topic := TopicName0}, AccId) ->
TopicName = iolist_to_binary(TopicName0),