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 | 4590a8ea2504eb60253cddf2c9f2b4ebca172423 (patch) | |
tree | 34495222a8845f71cd6e8b0eadefe5a74e268140 | |
parent | e7552bbd97c63d89b045fd34eece3900ccca7034 (diff) | |
download | rabbitmq-server-4590a8ea2504eb60253cddf2c9f2b4ebca172423.tar.gz |
Handle the case where we go from unmirrored(A) to nodes(B, C).
-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 3b25df6a..011f0663 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. |