Skip to content

Commit e1b336f

Browse files
committed
Remove compatibility for flag direct_exchange_routing_v2
Remove compatibility code for feature flag direct_exchange_routing_v2 because this feature flag is required in 3.12. See #7219
1 parent 35cf51b commit e1b336f

File tree

4 files changed

+16
-55
lines changed

4 files changed

+16
-55
lines changed

deps/rabbit/src/rabbit_core_ff.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
-rabbit_feature_flag(
7474
{direct_exchange_routing_v2,
7575
#{desc => "v2 direct exchange routing implementation",
76-
%%TODO remove compatibility code
7776
stability => required,
7877
depends_on => [feature_flags_v2, implicit_default_bindings]
7978
}}).

deps/rabbit/src/rabbit_db_binding.erl

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ delete(Tab, #index_route{} = Record, LockKind) ->
643643
%% types. This reduces write lock conflicts on the same tuple {SourceExchange, RoutingKey}
644644
%% reducing the number of restarted Mnesia transactions.
645645
should_index_table(#exchange{name = #resource{name = Name},
646-
type = direct})
646+
type = direct})
647647
when Name =/= <<>> ->
648648
true;
649649
should_index_table(_) ->
@@ -683,25 +683,10 @@ sync_route(Route, transient, ShouldIndexTable, Fun) ->
683683
sync_transient_route(Route, ShouldIndexTable, Fun) ->
684684
ok = Fun(?MNESIA_TABLE, Route, write),
685685
ok = Fun(?MNESIA_REVERSE_TABLE, rabbit_binding:reverse_route(Route), write),
686-
sync_index_route(Route, ShouldIndexTable, Fun).
686+
ok = sync_index_route(Route, ShouldIndexTable, Fun).
687687

688688
sync_index_route(Route, true, Fun) ->
689-
%% Do not block as blocking will cause a dead lock when
690-
%% function rabbit_binding:populate_index_route_table/0
691-
%% (i.e. feature flag migration) runs in parallel.
692-
case rabbit_feature_flags:is_enabled(direct_exchange_routing_v2, non_blocking) of
693-
true ->
694-
ok = Fun(?MNESIA_INDEX_TABLE, rabbit_binding:index_route(Route), write);
695-
false ->
696-
ok;
697-
state_changing ->
698-
case rabbit_table:exists(?MNESIA_INDEX_TABLE) of
699-
true ->
700-
ok = Fun(?MNESIA_INDEX_TABLE, rabbit_binding:index_route(Route), write);
701-
false ->
702-
ok
703-
end
704-
end;
689+
ok = Fun(?MNESIA_INDEX_TABLE, rabbit_binding:index_route(Route), write);
705690
sync_index_route(_, _, _) ->
706691
ok.
707692

deps/rabbit/src/rabbit_exchange_type_direct.erl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ serialise_events() -> false.
3333

3434
route(#exchange{name = Name, type = Type},
3535
#delivery{message = #basic_message{routing_keys = Routes}}) ->
36-
case {Type, rabbit_feature_flags:is_enabled(direct_exchange_routing_v2, non_blocking)} of
37-
{direct, true} ->
38-
route_v2(Name, Routes);
39-
_ ->
40-
rabbit_router:match_routing_key(Name, Routes)
36+
case Type of
37+
direct -> route_v2(Name, Routes);
38+
_ -> rabbit_router:match_routing_key(Name, Routes)
4139
end.
4240

4341
validate(_X) -> ok.

deps/rabbit/src/rabbit_table.erl

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
wait_for_replicated/1, wait/1, wait/2,
1313
force_load/0, is_present/0, is_empty/0, needs_default_data/0,
1414
check_schema_integrity/1, clear_ram_only_tables/0, retry_timeout/0,
15-
wait_for_replicated/0, exists/1]).
16-
17-
-export([rabbit_index_route_definition/0]).
15+
wait_for_replicated/0]).
1816

1917
%% for testing purposes
2018
-export([definitions/0]).
@@ -52,17 +50,6 @@ create(TableName, TableDefinition) ->
5250
throw({error, {table_creation_failed, TableName, TableDefinition1, Reason}})
5351
end.
5452

55-
-spec exists(atom()) -> boolean().
56-
exists(Table) ->
57-
case mnesia:is_transaction() of
58-
true ->
59-
_ = mnesia_schema:get_tid_ts_and_lock(schema, read),
60-
ok;
61-
false ->
62-
ok
63-
end,
64-
lists:member(Table, mnesia:system_info(tables)).
65-
6653
%% Sets up secondary indexes in a blank node database.
6754
ensure_secondary_indexes() ->
6855
ensure_secondary_index(rabbit_queue, vhost),
@@ -356,6 +343,14 @@ definitions() ->
356343
{type, ordered_set},
357344
{match, #reverse_route{reverse_binding = reverse_binding_match(),
358345
_='_'}}]},
346+
{rabbit_index_route,
347+
[{record_name, index_route},
348+
{attributes, record_info(fields, index_route)},
349+
{type, bag},
350+
{storage_properties, [{ets, [{read_concurrency, true}]}]},
351+
{match, #index_route{source_key = {exchange_name_match(), '_'},
352+
destination = binding_destination_match(),
353+
_='_'}}]},
359354
{rabbit_topic_trie_node,
360355
[{record_name, topic_trie_node},
361356
{attributes, record_info(fields, topic_trie_node)},
@@ -403,29 +398,13 @@ definitions() ->
403398
++ gm:table_definitions()
404399
++ mirrored_supervisor:table_definitions(),
405400

406-
MaybeRouting = case rabbit_feature_flags:is_enabled(direct_exchange_routing_v2) of
407-
true ->
408-
[{rabbit_index_route, rabbit_index_route_definition()}];
409-
false ->
410-
[]
411-
end,
412401
MaybeListener = case rabbit_feature_flags:is_enabled(listener_records_in_ets) of
413402
false ->
414403
[{rabbit_listener, rabbit_listener_definition()}];
415404
true ->
416405
[]
417406
end,
418-
Definitions ++ MaybeRouting ++ MaybeListener.
419-
420-
-spec rabbit_index_route_definition() -> list(tuple()).
421-
rabbit_index_route_definition() ->
422-
[{record_name, index_route},
423-
{attributes, record_info(fields, index_route)},
424-
{type, bag},
425-
{storage_properties, [{ets, [{read_concurrency, true}]}]},
426-
{match, #index_route{source_key = {exchange_name_match(), '_'},
427-
destination = binding_destination_match(),
428-
_='_'}}].
407+
Definitions ++ MaybeListener.
429408

430409
rabbit_listener_definition() ->
431410
[{record_name, listener},

0 commit comments

Comments
 (0)