summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_mirror_queue_misc.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl
index 8ad7c62f..9ebe2cfe 100644
--- a/src/rabbit_mirror_queue_misc.erl
+++ b/src/rabbit_mirror_queue_misc.erl
@@ -94,10 +94,15 @@ remove_from_queue(QueueName, Self, LiveGMPids) ->
%% Either master hasn't changed, so
%% we're ok to update mnesia; or we have
%% become the master.
- store_updated_slaves(
- Q #amqqueue { pid = QPid1,
+ Q1 = Q#amqqueue{pid = QPid1,
slave_pids = SPids1,
- gm_pids = GMPids1 }),
+ gm_pids = GMPids1},
+ store_updated_slaves(Q1),
+ %% If we add and remove nodes at the same time we
+ %% might tell the old master we need to sync and
+ %% then shut it down. So let's check if the new
+ %% master needs to sync.
+ maybe_auto_sync(Q1),
{ok, QPid1, [QPid | SPids] -- Alive};
_ ->
%% Master has changed, and we're not it,
@@ -314,6 +319,8 @@ update_mirrors0(OldQ = #amqqueue{name = QName},
NewNodes = [NewMNode | NewSNodes],
add_mirrors (QName, NewNodes -- OldNodes),
drop_mirrors(QName, OldNodes -- NewNodes),
+ %% This is for the case where no extra nodes were added but we changed to
+ %% a policy requiring auto-sync.
maybe_auto_sync(NewQ),
ok.