Merge pull request #7266 from rabbitmq/ff-direct_exchange_routing_v2

Remove compatibility for flag direct_exchange_routing_v2
This commit is contained in:
Michael Klishin 2023-02-13 22:30:43 -03:00 committed by GitHub
commit aec92b14d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 55 deletions

View File

@ -72,7 +72,6 @@
-rabbit_feature_flag(
{direct_exchange_routing_v2,
#{desc => "v2 direct exchange routing implementation",
%%TODO remove compatibility code
stability => required,
depends_on => [feature_flags_v2, implicit_default_bindings]
}}).

View File

@ -683,25 +683,10 @@ sync_route(Route, transient, ShouldIndexTable, Fun) ->
sync_transient_route(Route, ShouldIndexTable, Fun) ->
ok = Fun(?MNESIA_TABLE, Route, write),
ok = Fun(?MNESIA_REVERSE_TABLE, rabbit_binding:reverse_route(Route), write),
sync_index_route(Route, ShouldIndexTable, Fun).
ok = sync_index_route(Route, ShouldIndexTable, Fun).
sync_index_route(Route, true, Fun) ->
%% Do not block as blocking will cause a dead lock when
%% function rabbit_binding:populate_index_route_table/0
%% (i.e. feature flag migration) runs in parallel.
case rabbit_feature_flags:is_enabled(direct_exchange_routing_v2, non_blocking) of
true ->
ok = Fun(?MNESIA_INDEX_TABLE, rabbit_binding:index_route(Route), write);
false ->
ok;
state_changing ->
case rabbit_table:exists(?MNESIA_INDEX_TABLE) of
true ->
ok = Fun(?MNESIA_INDEX_TABLE, rabbit_binding:index_route(Route), write);
false ->
ok
end
end;
sync_index_route(_, _, _) ->
ok.

View File

@ -33,11 +33,9 @@ serialise_events() -> false.
route(#exchange{name = Name, type = Type},
#delivery{message = #basic_message{routing_keys = Routes}}) ->
case {Type, rabbit_feature_flags:is_enabled(direct_exchange_routing_v2, non_blocking)} of
{direct, true} ->
route_v2(Name, Routes);
_ ->
rabbit_router:match_routing_key(Name, Routes)
case Type of
direct -> route_v2(Name, Routes);
_ -> rabbit_router:match_routing_key(Name, Routes)
end.
validate(_X) -> ok.

View File

@ -12,9 +12,7 @@
wait_for_replicated/1, wait/1, wait/2,
force_load/0, is_present/0, is_empty/0, needs_default_data/0,
check_schema_integrity/1, clear_ram_only_tables/0, retry_timeout/0,
wait_for_replicated/0, exists/1]).
-export([rabbit_index_route_definition/0]).
wait_for_replicated/0]).
%% for testing purposes
-export([definitions/0]).
@ -52,17 +50,6 @@ create(TableName, TableDefinition) ->
throw({error, {table_creation_failed, TableName, TableDefinition1, Reason}})
end.
-spec exists(atom()) -> boolean().
exists(Table) ->
case mnesia:is_transaction() of
true ->
_ = mnesia_schema:get_tid_ts_and_lock(schema, read),
ok;
false ->
ok
end,
lists:member(Table, mnesia:system_info(tables)).
%% Sets up secondary indexes in a blank node database.
ensure_secondary_indexes() ->
ensure_secondary_index(rabbit_queue, vhost),
@ -356,6 +343,14 @@ definitions() ->
{type, ordered_set},
{match, #reverse_route{reverse_binding = reverse_binding_match(),
_='_'}}]},
{rabbit_index_route,
[{record_name, index_route},
{attributes, record_info(fields, index_route)},
{type, bag},
{storage_properties, [{ets, [{read_concurrency, true}]}]},
{match, #index_route{source_key = {exchange_name_match(), '_'},
destination = binding_destination_match(),
_='_'}}]},
{rabbit_topic_trie_node,
[{record_name, topic_trie_node},
{attributes, record_info(fields, topic_trie_node)},
@ -403,29 +398,13 @@ definitions() ->
++ gm:table_definitions()
++ mirrored_supervisor:table_definitions(),
MaybeRouting = case rabbit_feature_flags:is_enabled(direct_exchange_routing_v2) of
true ->
[{rabbit_index_route, rabbit_index_route_definition()}];
false ->
[]
end,
MaybeListener = case rabbit_feature_flags:is_enabled(listener_records_in_ets) of
false ->
[{rabbit_listener, rabbit_listener_definition()}];
true ->
[]
end,
Definitions ++ MaybeRouting ++ MaybeListener.
-spec rabbit_index_route_definition() -> list(tuple()).
rabbit_index_route_definition() ->
[{record_name, index_route},
{attributes, record_info(fields, index_route)},
{type, bag},
{storage_properties, [{ets, [{read_concurrency, true}]}]},
{match, #index_route{source_key = {exchange_name_match(), '_'},
destination = binding_destination_match(),
_='_'}}].
Definitions ++ MaybeListener.
rabbit_listener_definition() ->
[{record_name, listener},