Skip to content

Commit f8d4797

Browse files
Merge pull request #2273 from luos/fix_crashed_queues_on_startup
After network partition some classic queues are crashed, do not have mirrors (cherry picked from commit 3c1b317)
1 parent 2d7ce99 commit f8d4797

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/rabbit_mirror_queue_misc.erl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,21 @@ add_mirror(QName, MirrorNode, SyncMode) ->
243243
#resource{virtual_host = VHost} = amqqueue:get_name(Q),
244244
case rabbit_vhost_sup_sup:get_vhost_sup(VHost, MirrorNode) of
245245
{ok, _} ->
246-
SPid = rabbit_amqqueue_sup_sup:start_queue_process(
246+
try
247+
SPid = rabbit_amqqueue_sup_sup:start_queue_process(
247248
MirrorNode, Q, slave),
248-
log_info(QName, "Adding mirror on node ~p: ~p~n",
249+
log_info(QName, "Adding mirror on node ~p: ~p~n",
249250
[MirrorNode, SPid]),
250-
rabbit_mirror_queue_slave:go(SPid, SyncMode);
251+
rabbit_mirror_queue_slave:go(SPid, SyncMode)
252+
of
253+
_ -> ok
254+
catch
255+
error:QError ->
256+
log_warning(QName,
257+
"Unable to start queue mirror on node '~p'. "
258+
"Target queue supervisor is not running: ~p~n",
259+
[MirrorNode, QError])
260+
end;
251261
{error, Error} ->
252262
log_warning(QName,
253263
"Unable to start queue mirror on node '~p'. "

0 commit comments

Comments
 (0)