summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-09-05 13:25:03 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-09-05 13:25:03 +0100
commitf2f0bca55ac5aa772f1e1e781b5943785c8862b6 (patch)
tree5c01fc0acef922e0d3530a28436a4394ba2fa258 /src
parent31be44cec399122124c16df17baa9f6aa83a9fa5 (diff)
downloadrabbitmq-server-git-f2f0bca55ac5aa772f1e1e781b5943785c8862b6.tar.gz
Call add_mirror/2 before drop_mirror/2, and explain why.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mirror_queue_misc.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl
index 5ad04ff74b..9fb18457e0 100644
--- a/src/rabbit_mirror_queue_misc.erl
+++ b/src/rabbit_mirror_queue_misc.erl
@@ -288,7 +288,17 @@ update_mirrors(OldQ = #amqqueue{name = QName, pid = QPid},
NewNodes = All(suggested_queue_nodes(NewQ)),
Add = NewNodes -- OldNodes,
Remove = OldNodes -- NewNodes,
- [ok = drop_mirror(QName, Node) || Node <- Remove],
+ %% When a mirror dies, remove_from_queue/2
+ %% might have to add new slaves (in
+ %% "exactly" mode). It will check mnesia to
+ %% see which slaves there currently are. If
+ %% drop_mirror/2 is invoked first then when
+ %% we end up in remove_from_queue/2 it will
+ %% not see the slaves that add_mirror/2 will
+ %% add, and also want to add them (even
+ %% though we are not responding to the death
+ %% of a mirror). Breakage ensues.
[ok = add_mirror(QName, Node) || Node <- Add],
+ [ok = drop_mirror(QName, Node) || Node <- Remove],
ok
end.