diff options
| -rw-r--r-- | src/rabbit_binding.erl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 91f42e9c05..50e78eef8e 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -290,8 +290,9 @@ remove_for_source(SrcName) -> lock_route_tables(), Match = #route{binding = #binding{source = SrcName, _ = '_'}}, remove_routes( - lists:usort(mnesia:match_object(rabbit_route, Match, write) ++ - mnesia:match_object(rabbit_durable_route, Match, write))). + lists:usort( + mnesia:match_object(rabbit_route, Match, write) ++ + mnesia:match_object(rabbit_semi_durable_route, Match, write))). remove_for_destination(DstName) -> remove_for_destination(DstName, fun remove_routes/1). @@ -398,14 +399,17 @@ lock_route_tables() -> remove_routes(Routes) -> %% This partitioning allows us to suppress unnecessary delete %% operations on disk tables, which require an fsync. - {TransientRoutes, DurableRoutes} = + {RAMRoutes, DiscRoutes} = lists:partition(fun (R) -> mnesia:match_object( rabbit_durable_route, R, write) == [] end, Routes), - [ok = sync_transient_route(R, fun mnesia:delete_object/3) || - R <- TransientRoutes], - [ok = sync_route(R, fun mnesia:delete_object/3) || - R <- DurableRoutes], + %% 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) || + R <- RAMRoutes], + [ok = sync_route(R, false, false, fun mnesia:delete_object/3) || + R <- DiscRoutes], [R#route.binding || R <- Routes]. remove_transient_routes(Routes) -> |
