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 | 7339260059b0efca30fbf7f5335c6418077c60f8 (patch) | |
| tree | 6ac487e1c3ac411bb7d2b1025c184f6bcf2673c0 | |
| parent | 44cedcc53c3ebcf1893cf973b3a4b9eefc253288 (diff) | |
| parent | abe750022b5fbe822e031da5039e0f54918bcb13 (diff) | |
| download | rabbitmq-server-git-7339260059b0efca30fbf7f5335c6418077c60f8.tar.gz | |
Merged bug25499 into default
| -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 ead0c66102..fb74d4a3d4 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 c92e59639e..5640f12add 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. |
