|
34 | 34 | -export([notify_down_all/2, notify_down_all/3, activate_limit_all/2, credit/5]). |
35 | 35 | -export([on_node_up/1, on_node_down/1]). |
36 | 36 | -export([update/2, store_queue/1, update_decorators/1, policy_changed/2]). |
37 | | --export([update_mirroring/1, sync_mirrors/1, cancel_sync_mirrors/1, is_mirrored/1]). |
| 37 | +-export([update_mirroring/1, sync_mirrors/1, cancel_sync_mirrors/1]). |
| 38 | +-export([is_mirrored/1, is_dead_exclusive/1]). % Note: exported due to use in qlc expression. |
38 | 39 |
|
39 | 40 | -export([pid_of/1, pid_of/2]). |
40 | 41 |
|
@@ -919,6 +920,11 @@ cancel_sync_mirrors(QPid) -> delegate:call(QPid, cancel_sync_mi |
919 | 920 | is_mirrored(Q) -> |
920 | 921 | rabbit_mirror_queue_misc:is_mirrored(Q). |
921 | 922 |
|
| 923 | +is_dead_exclusive(#amqqueue{exclusive_owner = none}) -> |
| 924 | + false; |
| 925 | +is_dead_exclusive(#amqqueue{exclusive_owner = Pid}) when is_pid(Pid) -> |
| 926 | + not rabbit_mnesia:is_process_alive(Pid). |
| 927 | + |
922 | 928 | on_node_up(Node) -> |
923 | 929 | ok = rabbit_misc:execute_mnesia_transaction( |
924 | 930 | fun () -> |
@@ -963,11 +969,12 @@ on_node_down(Node) -> |
963 | 969 | rabbit_misc:execute_mnesia_tx_with_tail( |
964 | 970 | fun () -> QsDels = |
965 | 971 | qlc:e(qlc:q([{QName, delete_queue(QName)} || |
966 | | - #amqqueue{name = QName, pid = Pid} = Q |
967 | | - <- mnesia:table(rabbit_queue), |
968 | | - not rabbit_amqqueue:is_mirrored(Q) andalso |
969 | | - node(Pid) == Node andalso |
970 | | - not rabbit_mnesia:is_process_alive(Pid)])), |
| 972 | + #amqqueue{name = QName, pid = Pid} = |
| 973 | + Q <- mnesia:table(rabbit_queue), |
| 974 | + node(Pid) == Node andalso |
| 975 | + not rabbit_mnesia:is_process_alive(Pid) andalso |
| 976 | + (not rabbit_amqqueue:is_mirrored(Q) orelse |
| 977 | + rabbit_amqqueue:is_dead_exclusive(Q))])), |
971 | 978 | {Qs, Dels} = lists:unzip(QsDels), |
972 | 979 | T = rabbit_binding:process_deletions( |
973 | 980 | lists:foldl(fun rabbit_binding:combine_deletions/2, |
|
0 commit comments