Skip to content

Commit 7705d4e

Browse files
committed
Do dirty deletes when cleaning up bindings.
Dirty deletes are faster and idempotent, which means that it can be run in transaction as long as it's locked in the begining of transaction, which is done in `lock_resource`. Speed improvement is aquired by not setting record locks for each record, since we already have a record lock Addresses #1566 [#156352963]
1 parent 5cdee15 commit 7705d4e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/rabbit_binding.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ binding_action(Binding = #binding{source = SrcName,
339339
Fun(Src, Dst, Binding#binding{args = SortedArgs})
340340
end, ErrFun).
341341

342-
delete_object(Table, Record, LockKind) ->
343-
mnesia:delete_object(Table, Record, LockKind).
342+
dirty_delete_object(Table, Record, LockKind) ->
343+
mnesia:dirty_delete_object(Table, Record).
344344

345345
sync_route(Route, true, true, Fun) ->
346346
ok = Fun(rabbit_durable_route, Route, write),
@@ -411,15 +411,15 @@ remove_routes(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
413413
%% than check first
414-
[ok = sync_route(R, false, true, fun mnesia:delete_object/3) ||
414+
[ok = sync_route(R, false, true, fun dirty_delete_object/3) ||
415415
R <- RamRoutes],
416-
[ok = sync_route(R, true, true, fun mnesia:delete_object/3) ||
416+
[ok = sync_route(R, true, true, fun dirty_delete_object/3) ||
417417
R <- DiskRoutes],
418418
[R#route.binding || R <- Routes].
419419

420420
remove_transient_routes(Routes) ->
421421
[begin
422-
ok = sync_transient_route(R, fun delete_object/3),
422+
ok = sync_transient_route(R, fun dirty_delete_object/3),
423423
R#route.binding
424424
end || R <- Routes].
425425

0 commit comments

Comments
 (0)