fix(router): add / refine some comments and log messages

Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
This commit is contained in:
Andrew Mayorov 2023-08-30 19:51:00 +04:00
parent 063d6200c8
commit 6b9cb06334
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
2 changed files with 7 additions and 6 deletions

View File

@ -164,7 +164,8 @@ mria_insert_route(v2, 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()].
match_routes(Topic) when is_binary(Topic) ->
match_routes(get_schema_vsn(), Topic).
@ -174,6 +175,8 @@ match_routes(v2, 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()].
lookup_routes(Topic) ->
lookup_routes(get_schema_vsn(), Topic).
@ -399,8 +402,7 @@ has_route_v2(Topic, Dest) ->
cleanup_routes_v2(Node) ->
% NOTE
% No point in transaction here because all the operations on unified routing table
% are dirty.
% No point in transaction here because all the operations on filters table are dirty.
ok = ets:foldl(
fun(#routeidx{entry = K}, ok) ->
case get_dest_node(emqx_topic_index:get_id(K)) of
@ -472,8 +474,8 @@ init_schema() ->
});
_ ->
?SLOG(notice, #{
msg => "configured_routing_schema_unacceptable",
schema => Schema,
msg => "configured_routing_schema_ignored",
schema_in_use => Schema,
configured => ConfSchema,
reason =>
"Could not use configured routing storage schema because "

View File

@ -151,7 +151,6 @@ handle_info({nodedown, Node}, State = #{nodes := Nodes}) ->
% TODO
% Node may flap, do we need to wait for any pending cleanups in `init/1`
% on the flapping node?
% This also implies changing lock id to `{?LOCK, Node}`.
global:trans(
{?LOCK, self()},
fun() -> cleanup_routes(Node) end