summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-12-21 15:40:11 +0000
committerMatthew Sackman <matthew@rabbitmq.com>2010-12-21 15:40:11 +0000
commit8df5ca8a4153a43cdd03e2797fe1eb604943247f (patch)
treec09f112a93bb4a2e39e5e06b7c831e3a741b8168
parentfbcdab41943cb4c4b83d14325a4bee775b2af494 (diff)
downloadrabbitmq-server-git-8df5ca8a4153a43cdd03e2797fe1eb604943247f.tar.gz
Make the addition of slave nodes more robust. This is especially important for recovery of durable queues
-rw-r--r--src/rabbit_mirror_queue_coordinator.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl
index 6303952d1f..608148b5f4 100644
--- a/src/rabbit_mirror_queue_coordinator.erl
+++ b/src/rabbit_mirror_queue_coordinator.erl
@@ -70,9 +70,17 @@ handle_call(get_gm, _From, State = #state { gm = GM }) ->
reply(GM, State).
handle_cast({add_slave, Node}, State = #state { q = Q }) ->
- Result = rabbit_mirror_queue_slave_sup:start_child(Node, [Q]),
- rabbit_log:info("Adding slave node for queue ~p: ~p~n",
- [Q #amqqueue.name, Result]),
+ Nodes = nodes(),
+ case lists:member(Node, Nodes) of
+ true ->
+ Result = rabbit_mirror_queue_slave_sup:start_child(Node, [Q]),
+ rabbit_log:info("Adding slave node for queue ~p: ~p~n",
+ [Q #amqqueue.name, Result]);
+ false ->
+ rabbit_log:info(
+ "Ignoring request to add slave on node ~p for queue ~p~n",
+ [Q #amqqueue.name, Node])
+ end,
noreply(State);
handle_cast({gm_deaths, Deaths},