summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-09-05 13:28:04 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-09-05 13:28:04 +0100
commit1222f40fffaacc43a1741757f084952e260e6d0c (patch)
tree1c23974f6ac4ccbae5e09f88ecd7b548bdde9251
parent798fd411d873ad2b5f0fbee58ad2011717fa8529 (diff)
downloadrabbitmq-server-1222f40fffaacc43a1741757f084952e260e6d0c.tar.gz
Cosmetic: give that comment room to breath.
-rw-r--r--src/rabbit_mirror_queue_misc.erl41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl
index 9fb18457..5217e276 100644
--- a/src/rabbit_mirror_queue_misc.erl
+++ b/src/rabbit_mirror_queue_misc.erl
@@ -277,28 +277,29 @@ is_mirrored(Q) ->
_ -> false
end.
-update_mirrors(OldQ = #amqqueue{name = QName, pid = QPid},
- NewQ = #amqqueue{name = QName, pid = QPid}) ->
+update_mirrors(OldQ = #amqqueue{pid = QPid},
+ NewQ = #amqqueue{pid = QPid}) ->
case {is_mirrored(OldQ), is_mirrored(NewQ)} of
{false, false} -> ok;
{true, false} -> rabbit_amqqueue:stop_mirroring(QPid);
{false, true} -> rabbit_amqqueue:start_mirroring(QPid);
- {true, true} -> All = fun ({A,B}) -> [A|B] end,
- OldNodes = All(actual_queue_nodes(OldQ)),
- NewNodes = All(suggested_queue_nodes(NewQ)),
- Add = NewNodes -- OldNodes,
- Remove = OldNodes -- NewNodes,
- %% 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
+ {true, true} -> update_mirrors0(OldQ, NewQ)
end.
+
+update_mirrors0(OldQ = #amqqueue{name = QName},
+ NewQ = #amqqueue{name = QName}) ->
+ All = fun ({A,B}) -> [A|B] end,
+ OldNodes = All(actual_queue_nodes(OldQ)),
+ NewNodes = All(suggested_queue_nodes(NewQ)),
+ Add = NewNodes -- OldNodes,
+ Remove = OldNodes -- NewNodes,
+ %% 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.