diff options
author | Emile Joubert <emile@rabbitmq.com> | 2013-10-01 16:21:39 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2013-10-01 16:21:39 +0100 |
commit | 1fef1a3cd8433dd91c43bb98f51302b3262c0b0e (patch) | |
tree | af8662a8b7dbc954fd722879a776c782147638cf | |
parent | 9359c05eb2a22033a8b3ecaef08210686964cb6c (diff) | |
parent | 44da83019dd09b696d7ee4355bc7462f418c548e (diff) | |
download | rabbitmq-server-git-1fef1a3cd8433dd91c43bb98f51302b3262c0b0e.tar.gz |
Merged bug25780 into stable
-rw-r--r-- | src/rabbit_mnesia.erl | 3 | ||||
-rw-r--r-- | src/rabbit_node_monitor.erl | 21 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index d058ac36ea..0ed6c7b2ef 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -399,7 +399,8 @@ node_info() -> delegate_beam_hash(), cluster_status_from_mnesia()}. node_type() -> - DiscNodes = cluster_nodes(disc), + {_AllNodes, DiscNodes, _RunningNodes} = + rabbit_node_monitor:read_cluster_status(), case DiscNodes =:= [] orelse me_in_nodes(DiscNodes) of true -> disc; false -> ram diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index 57dce7cdb6..10e6819874 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -104,23 +104,19 @@ prepare_cluster_status_files() -> %% The running nodes file might contain a set or a list, in case %% of the legacy file RunningNodes2 = lists:usort(ThisNode ++ RunningNodes1), - {AllNodes1, WantDiscNode} = + {AllNodes1, DiscNodes} = case try_read_file(cluster_status_filename()) of {ok, [{AllNodes, DiscNodes0}]} -> - {AllNodes, lists:member(node(), DiscNodes0)}; + {AllNodes, DiscNodes0}; {ok, [AllNodes0]} when is_list(AllNodes0) -> - {legacy_cluster_nodes(AllNodes0), - legacy_should_be_disc_node(AllNodes0)}; + {legacy_cluster_nodes(AllNodes0), legacy_disc_nodes(AllNodes0)}; {ok, Files} -> Corrupt(Files); {error, enoent} -> - {legacy_cluster_nodes([]), true} + LegacyNodes = legacy_cluster_nodes([]), + {LegacyNodes, LegacyNodes} end, AllNodes2 = lists:usort(AllNodes1 ++ RunningNodes2), - DiscNodes = case WantDiscNode of - true -> ThisNode; - false -> [] - end, ok = write_cluster_status({AllNodes2, DiscNodes, RunningNodes2}). write_cluster_status({All, Disc, Running}) -> @@ -441,8 +437,11 @@ legacy_cluster_nodes(Nodes) -> %% list otherwise) lists:usort(Nodes ++ mnesia:system_info(db_nodes)). -legacy_should_be_disc_node(DiscNodes) -> - DiscNodes == [] orelse lists:member(node(), DiscNodes). +legacy_disc_nodes(AllNodes) -> + case AllNodes == [] orelse lists:member(node(), AllNodes) of + true -> [node()]; + false -> [] + end. add_node(Node, Nodes) -> lists:usort([Node | Nodes]). |