diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2012-09-05 13:28:04 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2012-09-05 13:28:04 +0100 |
| commit | 5f049990899e7646e43296066051de2c578b49e9 (patch) | |
| tree | 1c23974f6ac4ccbae5e09f88ecd7b548bdde9251 /src | |
| parent | f2f0bca55ac5aa772f1e1e781b5943785c8862b6 (diff) | |
| download | rabbitmq-server-git-5f049990899e7646e43296066051de2c578b49e9.tar.gz | |
Cosmetic: give that comment room to breath.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mirror_queue_misc.erl | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl index 9fb18457e0..5217e27604 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. |
