summaryrefslogtreecommitdiff
path: root/src/rabbit_mirror_queue_master.erl
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-11-12 15:03:12 +0000
committerSimon MacMullen <simon@rabbitmq.com>2013-11-12 15:03:12 +0000
commitcd629f5c15b4113b366bca43b159a55fa851dcfd (patch)
tree93764e81bfff6f0380f1f4031e31580c00c09518 /src/rabbit_mirror_queue_master.erl
parent451849adf9a5e0b589d5ed85af1663d129eebf19 (diff)
downloadrabbitmq-server-cd629f5c15b4113b366bca43b159a55fa851dcfd.tar.gz
Restore synchronous addition of slaves in the queue.declare case.
Diffstat (limited to 'src/rabbit_mirror_queue_master.erl')
-rw-r--r--src/rabbit_mirror_queue_master.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl
index 3abd81f5..d9cef642 100644
--- a/src/rabbit_mirror_queue_master.erl
+++ b/src/rabbit_mirror_queue_master.erl
@@ -110,7 +110,13 @@ init_with_existing_bq(Q = #amqqueue{name = QName}, BQ, BQS) ->
Q1#amqqueue{gm_pids = [{GM, Self} | GMPids]})
end),
{_MNode, SNodes} = rabbit_mirror_queue_misc:suggested_queue_nodes(Q),
- rabbit_mirror_queue_misc:add_mirrors(QName, SNodes),
+ %% We need synchronous add here (i.e. do not return until the
+ %% slave is running) so that when queue declaration is finished
+ %% all slaves are up; we don't want to end up with unsynced slaves
+ %% just by declaring a new queue. But add can't be synchronous all
+ %% the time as it can be called by slaves and that's
+ %% deadlock-prone.
+ rabbit_mirror_queue_misc:add_mirrors(QName, SNodes, sync),
#state { name = QName,
gm = GM,
coordinator = CPid,