summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mirror_queue_master.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl
index e6638b011b..ce0d8d3179 100644
--- a/src/rabbit_mirror_queue_master.erl
+++ b/src/rabbit_mirror_queue_master.erl
@@ -97,14 +97,17 @@ init(Q = #amqqueue{name = QName}, Recover, AsyncCallback) ->
ok = gm:broadcast(GM, {depth, BQ:depth(BQS)}),
State.
-init_with_existing_bq(Q, BQ, BQS) ->
+init_with_existing_bq(Q = #amqqueue{name = QName}, BQ, BQS) ->
{ok, CPid} = rabbit_mirror_queue_coordinator:start_link(
Q, undefined, sender_death_fun(), depth_fun()),
GM = rabbit_mirror_queue_coordinator:get_gm(CPid),
- Q1 = Q#amqqueue{gm_pids = [{GM, self()}]},
+ Self = self(),
ok = rabbit_misc:execute_mnesia_transaction(
fun () ->
- ok = rabbit_amqqueue:store_queue(Q1)
+ [Q1 = #amqqueue{gm_pids = GMPids}]
+ = mnesia:read({rabbit_queue, QName}),
+ Q2 = Q1#amqqueue{gm_pids = [{GM, Self} | GMPids]},
+ ok = rabbit_amqqueue:store_queue(Q2)
end),
#state { gm = GM,
coordinator = CPid,