summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-10-24 13:25:03 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-10-24 13:25:03 +0100
commit839c886755d361caf8b909f958eedd74a42083ee (patch)
treedfd5424d8ac228a0ca80d32587b4a6019ddf4c4b
parent46b2632199b75cf16a17fd47fd530f25352ac3e3 (diff)
downloadrabbitmq-server-bug25243.tar.gz
If the current master is currently not in the nodes specified, act like it is for the purposes of suggested_queue_nodes - otherwise we will not return it in the results.bug25243
-rw-r--r--src/rabbit_mirror_queue_misc.erl6
-rw-r--r--src/rabbit_tests.erl4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl
index 4a00846e..8a363f76 100644
--- a/src/rabbit_mirror_queue_misc.erl
+++ b/src/rabbit_mirror_queue_misc.erl
@@ -268,7 +268,11 @@ policy(Policy, Q) ->
suggested_queue_nodes(<<"all">>, _Params, {MNode, _SNodes}, Possible) ->
{MNode, Possible -- [MNode]};
suggested_queue_nodes(<<"nodes">>, Nodes0, {MNode, _SNodes}, Possible) ->
- Nodes = [list_to_atom(binary_to_list(Node)) || Node <- Nodes0],
+ Nodes1 = [list_to_atom(binary_to_list(Node)) || Node <- Nodes0],
+ %% If the current master is currently not in the nodes specified,
+ %% act like it is for the purposes below - otherwise we will not
+ %% return it in the results...
+ Nodes = lists:usort([MNode | Nodes1]),
Unavailable = Nodes -- Possible,
Available = Nodes -- Unavailable,
case Available of
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 962bb648..afc10b9f 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -914,12 +914,12 @@ test_dynamic_mirroring() ->
Test({b,[a,c],0},<<"nodes">>,[<<"a">>,<<"b">>,<<"c">>],{b,[a]},[a,b,c,d]),
%% Add two nodes and drop one
Test({a,[b,c],0},<<"nodes">>,[<<"a">>,<<"b">>,<<"c">>],{a,[d]},[a,b,c,d]),
- %% Promote slave to master by policy
- Test({a,[b,c],0},<<"nodes">>,[<<"a">>,<<"b">>,<<"c">>],{d,[a]},[a,b,c,d]),
%% Don't try to include nodes that are not running
Test({a,[b], 0},<<"nodes">>,[<<"a">>,<<"b">>,<<"f">>],{a,[b]},[a,b,c,d]),
%% If we can't find any of the nodes listed then just keep the master
Test({a,[], 0},<<"nodes">>,[<<"f">>,<<"g">>,<<"h">>],{a,[b]},[a,b,c,d]),
+ %% And once that's happened, still keep the master even when not listed
+ Test({a,[b,c],0},<<"nodes">>,[<<"b">>,<<"c">>], {a,[]}, [a,b,c,d]),
Test({a,[], 1},<<"exactly">>,2,{a,[]}, [a,b,c,d]),
Test({a,[], 2},<<"exactly">>,3,{a,[]}, [a,b,c,d]),