diff options
author | Emile Joubert <emile@rabbitmq.com> | 2013-03-27 15:17:39 +0000 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2013-03-27 15:17:39 +0000 |
commit | 85c13eb713440de1d8b24ef1c5be9cceb0e1d8f5 (patch) | |
tree | 6ac487e1c3ac411bb7d2b1025c184f6bcf2673c0 /src | |
parent | 5531872ad348f30afc9a43af8cacdc1420cc4f14 (diff) | |
parent | 24667bfce161c25bfca584e85d3ebec65156930e (diff) | |
download | rabbitmq-server-85c13eb713440de1d8b24ef1c5be9cceb0e1d8f5.tar.gz |
Merged bug25499 into default
Diffstat (limited to 'src')
-rw-r--r-- | src/rabbit_node_monitor.erl | 5 | ||||
-rw-r--r-- | src/rabbit_nodes.erl | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index ead0c661..fb74d4a3 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -348,6 +348,9 @@ alive_nodes() -> alive_nodes(rabbit_mnesia:cluster_nodes(all)). alive_nodes(Nodes) -> [N || N <- Nodes, pong =:= net_adm:ping(N)]. +alive_rabbit_nodes() -> + [N || N <- alive_nodes(), rabbit_nodes:is_process_running(N, rabbit)]. + await_cluster_recovery() -> rabbit_log:warning("Cluster minority status detected - awaiting recovery~n", []), @@ -376,7 +379,7 @@ handle_dead_rabbit_state(State = #state{partitions = Partitions}) -> %% that we do not attempt to deal with individual (other) partitions %% going away. It's only safe to forget anything about partitions when %% there are no partitions. - Partitions1 = case Partitions -- (Partitions -- alive_nodes()) of + Partitions1 = case Partitions -- (Partitions -- alive_rabbit_nodes()) of [] -> []; _ -> Partitions end, diff --git a/src/rabbit_nodes.erl b/src/rabbit_nodes.erl index c92e5963..5640f12a 100644 --- a/src/rabbit_nodes.erl +++ b/src/rabbit_nodes.erl @@ -16,7 +16,8 @@ -module(rabbit_nodes). --export([names/1, diagnostics/1, make/1, parts/1, cookie_hash/0, is_running/2]). +-export([names/1, diagnostics/1, make/1, parts/1, cookie_hash/0, + is_running/2, is_process_running/2]). -define(EPMD_TIMEOUT, 30000). @@ -33,6 +34,7 @@ -spec(parts/1 :: (node() | string()) -> {string(), string()}). -spec(cookie_hash/0 :: () -> string()). -spec(is_running/2 :: (node(), atom()) -> boolean()). +-spec(is_process_running/2 :: (node(), atom()) -> boolean()). -endif. @@ -98,3 +100,10 @@ is_running(Node, Application) -> {badrpc, _} -> false; Apps -> proplists:is_defined(Application, Apps) end. + +is_process_running(Node, Process) -> + case rpc:call(Node, erlang, whereis, [Process]) of + {badrpc, _} -> false; + undefined -> false; + P when is_pid(P) -> true + end. |