summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_mirror_queue_misc.erl37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl
index 017a5187fb..7c7fbbeb0d 100644
--- a/src/rabbit_mirror_queue_misc.erl
+++ b/src/rabbit_mirror_queue_misc.erl
@@ -202,34 +202,23 @@ add_mirrors(QName, Nodes, SyncMode) ->
add_mirror(QName, MirrorNode, SyncMode) ->
case rabbit_amqqueue:lookup(QName) of
- {ok, #amqqueue { name = Name, pid = QPid, slave_pids = SPids } = Q} ->
- case [Pid || Pid <- [QPid | SPids], node(Pid) =:= MirrorNode] of
- [] ->
- start_child(Name, MirrorNode, Q, SyncMode);
- [SPid] ->
- case rabbit_misc:is_process_alive(SPid) of
- true -> {ok, already_mirrored};
- false -> start_child(Name, MirrorNode, Q, SyncMode)
- end
- end;
+ {ok, Q} ->
+ rabbit_misc:with_exit_handler(
+ rabbit_misc:const(ok),
+ fun () ->
+ SPid = rabbit_amqqueue_sup:start_queue_process(
+ MirrorNode, Q, slave),
+ log_info(QName, "Adding mirror on node ~p: ~p~n",
+ [MirrorNode, SPid]),
+ case SyncMode of
+ sync -> rabbit_mirror_queue_slave:await(SPid);
+ async -> ok
+ end
+ end);
{error, not_found} = E ->
E
end.
-start_child(Name, MirrorNode, Q, SyncMode) ->
- rabbit_misc:with_exit_handler(
- rabbit_misc:const(ok),
- fun () ->
- SPid = rabbit_amqqueue_sup:start_queue_process(
- MirrorNode, Q, slave),
- log_info(Name, "Adding mirror on node ~p: ~p~n",
- [MirrorNode, SPid]),
- case SyncMode of
- sync -> rabbit_mirror_queue_slave:await(SPid);
- async -> ok
- end
- end).
-
report_deaths(_MirrorPid, _IsMaster, _QueueName, []) ->
ok;
report_deaths(MirrorPid, IsMaster, QueueName, DeadPids) ->