summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <michael@novemberain.com>2018-08-30 20:31:38 +0300
committerGitHub <noreply@github.com>2018-08-30 20:31:38 +0300
commitf0a68adcd1c79a3020ab324ef59026d3d54d379d (patch)
tree5417817c481881f3d6d850299a92753266bd5a7c /src
parent25a3fe486a39d42c13680cf8f8e6990c0f13a511 (diff)
parent98040f6e8b9142baae025cf904289e61d7e6d7af (diff)
downloadrabbitmq-server-git-f0a68adcd1c79a3020ab324ef59026d3d54d379d.tar.gz
Merge pull request #1691 from rabbitmq/remove-bindings
Idempotent binding removal
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_binding.erl14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl
index a6907b8ce6..f2bcd93b74 100644
--- a/src/rabbit_binding.erl
+++ b/src/rabbit_binding.erl
@@ -343,9 +343,6 @@ binding_action(Binding = #binding{source = SrcName,
Fun(Src, Dst, Binding#binding{args = SortedArgs})
end, ErrFun).
-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),
sync_route(Route, false, true, Fun);
@@ -415,15 +412,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 dirty_delete_object/3) ||
+ [ok = sync_route(R, false, true, fun mnesia:delete_object/3) ||
R <- RamRoutes],
- [ok = sync_route(R, true, true, fun dirty_delete_object/3) ||
+ [ok = sync_route(R, true, true, fun mnesia:delete_object/3) ||
R <- DiskRoutes],
[R#route.binding || R <- Routes].
remove_transient_routes(Routes) ->
[begin
- ok = sync_transient_route(R, fun dirty_delete_object/3),
+ ok = sync_transient_route(R, fun mnesia:delete_object/3),
R#route.binding
end || R <- Routes].
@@ -447,10 +444,7 @@ remove_for_destination(DstName, OnlyDurable, Fun) ->
lists:keysort(#binding.source, Bindings), OnlyDurable).
%% Instead of locking entire table on remove operations we can lock the
-%% affected resource only. This will allow us to use dirty_match_object for
-%% do faster search of records to delete.
-%% This works better when there are multiple resources deleted at once, for
-%% example when exclusive queues are deleted.
+%% affected resource only.
lock_resource(Name) ->
mnesia:lock({global, Name, mnesia:table_info(rabbit_route, where_to_write)},
write).