Skip to content

Commit d0423f9

Browse files
committed
Bring back transactional match_object for bindings cleanup.
Follow up to 5cdee15 dirty_match_object does not provide much performance improvement while it's breaking auto-delete exchanges cleanup. A transaction with a binding deletion will call auto-delete exchange removal, which will call a cleanup. On this cleanup the deleted binding should not be dirty-deleted again. Follow-up to #1589 [#156352963]
1 parent c395246 commit d0423f9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/rabbit_binding.erl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ remove_for_source(SrcName) ->
315315
Match = #route{binding = #binding{source = SrcName, _ = '_'}},
316316
remove_routes(
317317
lists:usort(
318-
mnesia:dirty_match_object(rabbit_route, Match) ++
319-
mnesia:dirty_match_object(rabbit_semi_durable_route, Match))).
318+
mnesia:match_object(rabbit_route, Match, read) ++
319+
mnesia:match_object(rabbit_semi_durable_route, Match, read))).
320320

321321
remove_for_destination(DstName, OnlyDurable) ->
322322
remove_for_destination(DstName, OnlyDurable, fun remove_routes/1).
@@ -405,8 +405,8 @@ remove_routes(Routes) ->
405405
%% This partitioning allows us to suppress unnecessary delete
406406
%% operations on disk tables, which require an fsync.
407407
{RamRoutes, DiskRoutes} =
408-
lists:partition(fun (R) -> mnesia:dirty_match_object(
409-
rabbit_durable_route, R) == [] end,
408+
lists:partition(fun (R) -> mnesia:match_object(
409+
rabbit_durable_route, R, read) == [] end,
410410
Routes),
411411
%% Of course the destination might not really be durable but it's
412412
%% just as easy to try to delete it from the semi-durable table
@@ -430,13 +430,13 @@ remove_for_destination(DstName, OnlyDurable, Fun) ->
430430
Routes = case OnlyDurable of
431431
false ->
432432
[reverse_route(R) ||
433-
R <- mnesia:dirty_match_object(
434-
rabbit_reverse_route, MatchRev)];
433+
R <- mnesia:match_object(
434+
rabbit_reverse_route, MatchRev, read)];
435435
true -> lists:usort(
436-
mnesia:dirty_match_object(
437-
rabbit_durable_route, MatchFwd) ++
438-
mnesia:dirty_match_object(
439-
rabbit_semi_durable_route, MatchFwd))
436+
mnesia:match_object(
437+
rabbit_durable_route, MatchFwd, read) ++
438+
mnesia:match_object(
439+
rabbit_semi_durable_route, MatchFwd, read))
440440
end,
441441
Bindings = Fun(Routes),
442442
group_bindings_fold(fun maybe_auto_delete/4, new_deletions(),

0 commit comments

Comments
 (0)