diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-10-15 17:41:19 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-10-15 17:41:19 +0100 |
commit | 97b64312544daef499dc979577e1e46414c292e5 (patch) | |
tree | c95ace3d3d244566d259e8c35887fd47738a5c74 | |
parent | e393dd30ad938d900c97ac9d27b74717e8acad8c (diff) | |
download | rabbitmq-server-97b64312544daef499dc979577e1e46414c292e5.tar.gz |
Remove from the semi_durable table when removing an exchange even if the routes are not in the durable table. And rephrase a bit in remove_routes/1, it's RAM vs disc that we care about here.
-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 91f42e9c..50e78eef 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) -> |