fix(router): add / refine some comments and log messages
Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
This commit is contained in:
parent
063d6200c8
commit
6b9cb06334
|
@ -164,7 +164,8 @@ mria_insert_route(v2, Topic, Dest) ->
|
||||||
mria_insert_route(v1, Topic, Dest) ->
|
mria_insert_route(v1, Topic, Dest) ->
|
||||||
mria_insert_route_v1(Topic, Dest).
|
mria_insert_route_v1(Topic, Dest).
|
||||||
|
|
||||||
%% @doc Match routes
|
%% @doc Take a real topic (not filter) as input, return the matching topics and topic
|
||||||
|
%% filters associated with route destination.
|
||||||
-spec match_routes(emqx_types:topic()) -> [emqx_types:route()].
|
-spec match_routes(emqx_types:topic()) -> [emqx_types:route()].
|
||||||
match_routes(Topic) when is_binary(Topic) ->
|
match_routes(Topic) when is_binary(Topic) ->
|
||||||
match_routes(get_schema_vsn(), Topic).
|
match_routes(get_schema_vsn(), Topic).
|
||||||
|
@ -174,6 +175,8 @@ match_routes(v2, Topic) ->
|
||||||
match_routes(v1, Topic) ->
|
match_routes(v1, Topic) ->
|
||||||
match_routes_v1(Topic).
|
match_routes_v1(Topic).
|
||||||
|
|
||||||
|
%% @doc Take a topic or filter as input, and return the existing routes with exactly
|
||||||
|
%% this topic or filter.
|
||||||
-spec lookup_routes(emqx_types:topic()) -> [emqx_types:route()].
|
-spec lookup_routes(emqx_types:topic()) -> [emqx_types:route()].
|
||||||
lookup_routes(Topic) ->
|
lookup_routes(Topic) ->
|
||||||
lookup_routes(get_schema_vsn(), Topic).
|
lookup_routes(get_schema_vsn(), Topic).
|
||||||
|
@ -399,8 +402,7 @@ has_route_v2(Topic, Dest) ->
|
||||||
|
|
||||||
cleanup_routes_v2(Node) ->
|
cleanup_routes_v2(Node) ->
|
||||||
% NOTE
|
% NOTE
|
||||||
% No point in transaction here because all the operations on unified routing table
|
% No point in transaction here because all the operations on filters table are dirty.
|
||||||
% are dirty.
|
|
||||||
ok = ets:foldl(
|
ok = ets:foldl(
|
||||||
fun(#routeidx{entry = K}, ok) ->
|
fun(#routeidx{entry = K}, ok) ->
|
||||||
case get_dest_node(emqx_topic_index:get_id(K)) of
|
case get_dest_node(emqx_topic_index:get_id(K)) of
|
||||||
|
@ -472,8 +474,8 @@ init_schema() ->
|
||||||
});
|
});
|
||||||
_ ->
|
_ ->
|
||||||
?SLOG(notice, #{
|
?SLOG(notice, #{
|
||||||
msg => "configured_routing_schema_unacceptable",
|
msg => "configured_routing_schema_ignored",
|
||||||
schema => Schema,
|
schema_in_use => Schema,
|
||||||
configured => ConfSchema,
|
configured => ConfSchema,
|
||||||
reason =>
|
reason =>
|
||||||
"Could not use configured routing storage schema because "
|
"Could not use configured routing storage schema because "
|
||||||
|
|
|
@ -151,7 +151,6 @@ handle_info({nodedown, Node}, State = #{nodes := Nodes}) ->
|
||||||
% TODO
|
% TODO
|
||||||
% Node may flap, do we need to wait for any pending cleanups in `init/1`
|
% Node may flap, do we need to wait for any pending cleanups in `init/1`
|
||||||
% on the flapping node?
|
% on the flapping node?
|
||||||
% This also implies changing lock id to `{?LOCK, Node}`.
|
|
||||||
global:trans(
|
global:trans(
|
||||||
{?LOCK, self()},
|
{?LOCK, self()},
|
||||||
fun() -> cleanup_routes(Node) end
|
fun() -> cleanup_routes(Node) end
|
||||||
|
|
Loading…
Reference in New Issue