summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Fedotov <hairyhum@gmail.com>2018-05-14 17:49:12 +0100
committerDaniil Fedotov <hairyhum@gmail.com>2018-05-14 17:49:12 +0100
commit7705d4e682b780575b6697d30781e0a9493b0db6 (patch)
tree1bc75f53aafe75ddd6e63ae5ea80e17f3be06301 /src
parent5cdee1530d5002b316b80f488a5d87417e1d0db0 (diff)
downloadrabbitmq-server-git-7705d4e682b780575b6697d30781e0a9493b0db6.tar.gz
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]
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_binding.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl
index 06a71ce995..ba28cbeb70 100644
--- a/src/rabbit_binding.erl
+++ b/src/rabbit_binding.erl
@@ -339,8 +339,8 @@ binding_action(Binding = #binding{source = SrcName,
Fun(Src, Dst, Binding#binding{args = SortedArgs})
end, ErrFun).
-delete_object(Table, Record, LockKind) ->
- mnesia:delete_object(Table, Record, LockKind).
+dirty_delete_object(Table, Record, LockKind) ->
+ mnesia:dirty_delete_object(Table, Record).
sync_route(Route, true, true, Fun) ->
ok = Fun(rabbit_durable_route, Route, write),
@@ -411,15 +411,15 @@ remove_routes(Routes) ->
%% Of course the destination might not really be durable but it's
%% just as easy to try to delete it from the semi-durable table
%% than check first
- [ok = sync_route(R, false, true, fun mnesia:delete_object/3) ||
+ [ok = sync_route(R, false, true, fun dirty_delete_object/3) ||
R <- RamRoutes],
- [ok = sync_route(R, true, true, fun mnesia:delete_object/3) ||
+ [ok = sync_route(R, true, true, fun dirty_delete_object/3) ||
R <- DiskRoutes],
[R#route.binding || R <- Routes].
remove_transient_routes(Routes) ->
[begin
- ok = sync_transient_route(R, fun delete_object/3),
+ ok = sync_transient_route(R, fun dirty_delete_object/3),
R#route.binding
end || R <- Routes].