summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-08-19 15:39:48 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-08-19 15:39:48 +0100
commite00d04982ae1b630939120dc4f1c94e95a1cc63d (patch)
treea25d1a39b49f71377c5c7b3a77b358dd74a0bd92
parenta34e13465725855a8707a8897a12088ec49d1a29 (diff)
downloadrabbitmq-server-e00d04982ae1b630939120dc4f1c94e95a1cc63d.tar.gz
Remove a pointless check here - we will check from within an Mnesia tx in rabbit_mirror_queue_slave:init_it/4 anyway, which makes much more sense (and it will make little sense to check at slave start if we can restart a crashed slave).
-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 017a5187..7c7fbbeb 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) ->