Skip to content

Commit 5d9a748

Browse files
committed
Idempotent binding removal
Optimizations introduced in #1589 caused the removal of bindings to be non-idempotent, as the removal of routing information with dirty deletes did not allow for full transaction rollback. This commit reverts that change, losing some of the performance improvements in favour of data correctness.
1 parent 46ca0db commit 5d9a748

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/rabbit_binding.erl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,6 @@ binding_action(Binding = #binding{source = SrcName,
343343
Fun(Src, Dst, Binding#binding{args = SortedArgs})
344344
end, ErrFun).
345345

346-
dirty_delete_object(Table, Record, _LockKind) ->
347-
mnesia:dirty_delete_object(Table, Record).
348-
349346
sync_route(Route, true, true, Fun) ->
350347
ok = Fun(rabbit_durable_route, Route, write),
351348
sync_route(Route, false, true, Fun);
@@ -415,15 +412,15 @@ remove_routes(Routes) ->
415412
%% Of course the destination might not really be durable but it's
416413
%% just as easy to try to delete it from the semi-durable table
417414
%% than check first
418-
[ok = sync_route(R, false, true, fun dirty_delete_object/3) ||
415+
[ok = sync_route(R, false, true, fun mnesia:delete_object/3) ||
419416
R <- RamRoutes],
420-
[ok = sync_route(R, true, true, fun dirty_delete_object/3) ||
417+
[ok = sync_route(R, true, true, fun mnesia:delete_object/3) ||
421418
R <- DiskRoutes],
422419
[R#route.binding || R <- Routes].
423420

424421
remove_transient_routes(Routes) ->
425422
[begin
426-
ok = sync_transient_route(R, fun dirty_delete_object/3),
423+
ok = sync_transient_route(R, fun mnesia:delete_object/3),
427424
R#route.binding
428425
end || R <- Routes].
429426

0 commit comments

Comments
 (0)