summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-04-18 18:10:03 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-04-18 18:10:03 +0100
commit58fb136705db9b9ccced0425eabce9b60af04125 (patch)
tree256893d21bb7b9d5f0147f25ab9861f4adca3739
parent831e26f3c6b2f4ce762f696db0f1bbba03bf3747 (diff)
downloadrabbitmq-server-58fb136705db9b9ccced0425eabce9b60af04125.tar.gz
Prompt Mnesia to notice we've reconnected in case it doesn't notice itself.
-rw-r--r--src/rabbit_node_monitor.erl22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl
index fb74d4a3..ecfa75d1 100644
--- a/src/rabbit_node_monitor.erl
+++ b/src/rabbit_node_monitor.erl
@@ -280,17 +280,10 @@ handle_info(ping_nodes, State) ->
%% to ping the nodes that are up, after all.
State1 = State#state{down_ping_timer = undefined},
Self = self(),
- %% all_nodes_up() both pings all the nodes and tells us if we need to again.
- %%
%% We ping in a separate process since in a partition it might
%% take some noticeable length of time and we don't want to block
%% the node monitor for that long.
- spawn_link(fun () ->
- case all_nodes_up() of
- true -> ok;
- false -> Self ! ping_again
- end
- end),
+ spawn_link(fun () -> ping_nodes(Self) end),
{noreply, State1};
handle_info(ping_again, State) ->
@@ -385,6 +378,19 @@ handle_dead_rabbit_state(State = #state{partitions = Partitions}) ->
end,
ensure_ping_timer(State#state{partitions = Partitions1}).
+%% all_nodes_up() both pings all the nodes and tells us if we need to again.
+ping_nodes(Self) ->
+ DownNodes = [Node || Node <- rabbit_mnesia:cluster_nodes(all),
+ mnesia_recover:has_mnesia_down(Node)],
+ case DownNodes of
+ [] -> ok;
+ _ -> [begin
+ net_adm:ping(Node),
+ spawn_link(mnesia_monitor, detect_partitioned_network,
+ [self(), Node])
+ end || Node <- DownNodes]
+ end.
+
ensure_ping_timer(State) ->
rabbit_misc:ensure_timer(
State, #state.down_ping_timer, ?RABBIT_DOWN_PING_INTERVAL, ping_nodes).