diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2012-09-20 14:47:52 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2012-09-20 14:47:52 +0100 |
| commit | 68a220c3aa2dd247a2ee73c87608cfb07da69bf3 (patch) | |
| tree | 34495222a8845f71cd6e8b0eadefe5a74e268140 /src | |
| parent | 99ad4ef213496348b1c7af5591b48c637baa1522 (diff) | |
| download | rabbitmq-server-git-68a220c3aa2dd247a2ee73c87608cfb07da69bf3.tar.gz | |
Handle the case where we go from unmirrored(A) to nodes(B, C).
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mirror_queue_misc.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl index 3b25df6a89..011f0663fd 100644 --- a/src/rabbit_mirror_queue_misc.erl +++ b/src/rabbit_mirror_queue_misc.erl @@ -281,12 +281,19 @@ is_mirrored(Q) -> _ -> false end. + +%% [1] - rabbit_amqqueue:start_mirroring/1 will turn unmirrored to +%% master and start any needed slaves. However, if node(QPid) is not +%% in the nodes for the policy, it won't switch it. So this is for the +%% case where we kill the existing queue and restart elsewhere. TODO: +%% is this TRTTD? All alternatives seem ugly. 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); + {false, true} -> rabbit_amqqueue:start_mirroring(QPid), + update_mirrors0(OldQ, NewQ); %% [1] {true, true} -> update_mirrors0(OldQ, NewQ) end. |
