diff options
author | Emile Joubert <emile@rabbitmq.com> | 2013-10-01 16:22:55 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2013-10-01 16:22:55 +0100 |
commit | ec107f9c0b823d9d616d4298d1db5a6d1a319bc7 (patch) | |
tree | f660cb23b6eb2fd58495551cdc888b898dfda238 /src | |
parent | 9acfab8fb01d7d3ccfefc25ef4c7a043924dd123 (diff) | |
parent | aef7cd5feb01c54f487e8e133af54399ecc632fb (diff) | |
download | rabbitmq-server-ec107f9c0b823d9d616d4298d1db5a6d1a319bc7.tar.gz |
Merged stable into default
Diffstat (limited to 'src')
-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 4990bce3..3a8fae7f 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -399,7 +399,8 @@ node_info() -> 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 57dce7cd..10e68198 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]). |