Skip to content

Commit 2800d08

Browse files
committed
Do not set table-wide and partial locks when deleting bindings.
Table-wide locks are supposed to improve performance for bulk oprations for a single entity, but block operations for multole entities, for example exclusive queues. Partial locks were there since forever without any clear justification, and I don't see any good reasons to keep them. Delete operation will aquire a lock for an actual record avoiding partial table locks. Addresses #1566 [#156352963]
1 parent 4005308 commit 2800d08

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/rabbit_binding.erl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ remove_routes(Routes) ->
418418
%% operations on disk tables, which require an fsync.
419419
{RamRoutes, DiskRoutes} =
420420
lists:partition(fun (R) -> mnesia:match_object(
421-
rabbit_durable_route, R, write) == [] end,
421+
rabbit_durable_route, R) == [] end,
422422
Routes),
423423
%% Of course the destination might not really be durable but it's
424424
%% just as easy to try to delete it from the semi-durable table
@@ -436,18 +436,18 @@ remove_transient_routes(Routes) ->
436436
end || R <- Routes].
437437

438438
remove_for_destination(DstName, OnlyDurable, Fun) ->
439-
lock_route_tables(),
440439
MatchFwd = #route{binding = #binding{destination = DstName, _ = '_'}},
441440
MatchRev = reverse_route(MatchFwd),
442441
Routes = case OnlyDurable of
443-
false -> [reverse_route(R) ||
442+
false ->
443+
[reverse_route(R) ||
444444
R <- mnesia:match_object(
445-
rabbit_reverse_route, MatchRev, write)];
445+
rabbit_reverse_route, MatchRev)];
446446
true -> lists:usort(
447447
mnesia:match_object(
448-
rabbit_durable_route, MatchFwd, write) ++
448+
rabbit_durable_route, MatchFwd) ++
449449
mnesia:match_object(
450-
rabbit_semi_durable_route, MatchFwd, write))
450+
rabbit_semi_durable_route, MatchFwd))
451451
end,
452452
Bindings = Fun(Routes),
453453
group_bindings_fold(fun maybe_auto_delete/4, new_deletions(),

0 commit comments

Comments
 (0)