summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-09-19 14:29:00 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-09-19 14:29:00 +0100
commit2df7dad44e6290ce25361dc18e9087e041f7bccc (patch)
treee60b7d5c6b383bc6859d833ccdba6215ac30d5be
parent4c3f9bdf2d7446a91255070f1020a2f4e1eb5b9c (diff)
parent9a56f663cd1e7697161005dc9769bb655fb6ccfc (diff)
downloadrabbitmq-server-2df7dad44e6290ce25361dc18e9087e041f7bccc.tar.gz
Merge bug25167
-rw-r--r--src/rabbit_mnesia.erl20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 611f7dda..8ce19cc6 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -422,8 +422,8 @@ mnesia_nodes() ->
end.
cluster_status(WhichNodes, ForceMnesia) ->
- %% I don't want to call `running_nodes/1' unless if necessary,
- %% since it can deadlock when stopping applications.
+ %% I don't want to call `running_nodes/1' unless if necessary, since it's
+ %% pretty expensive.
Nodes = case mnesia_nodes() of
{ok, {AllNodes, DiscNodes}} ->
{ok, {AllNodes, DiscNodes,
@@ -431,10 +431,9 @@ cluster_status(WhichNodes, ForceMnesia) ->
{error, _Reason} when not ForceMnesia ->
{AllNodes, DiscNodes, RunningNodes} =
rabbit_node_monitor:read_cluster_status(),
- %% The cluster status file records the status when
- %% the node is online, but we know for sure that
- %% the node is offline now, so we can remove it
- %% from the list of running nodes.
+ %% The cluster status file records the status when the node
+ %% is online, but we know for sure that the node is offline
+ %% now, so we can remove it from the list of running nodes.
{ok,
{AllNodes, DiscNodes,
fun() -> ordsets:del_element(node(), RunningNodes) end}};
@@ -1053,18 +1052,15 @@ change_extra_db_nodes(ClusterNodes0, Force) ->
Nodes
end.
-%% What we really want is nodes running rabbit, not running
-%% mnesia. Using `mnesia:system_info(running_db_nodes)' will
-%% return false positives when we are actually just doing cluster
-%% operations (e.g. joining the cluster).
+%% We're not using `mnesia:system_info(running_db_nodes)' directly because if
+%% the node is a RAM node it won't know about other nodes when mnesia is stopped
running_nodes(Nodes) ->
{Replies, _BadNodes} =
rpc:multicall(Nodes, rabbit_mnesia, is_running_remote, []),
[Node || {Running, Node} <- Replies, Running].
is_running_remote() ->
- {proplists:is_defined(rabbit, application:which_applications(infinity)),
- node()}.
+ {mnesia:system_info(is_running) =:= yes, node()}.
check_consistency(OTP, Rabbit) ->
rabbit_misc:sequence_error(