summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-07-20 14:22:44 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-07-20 14:22:44 +0100
commitcab1334151fcb54c979075742a1441dc3cd63166 (patch)
treea3dd69961ad91f3bbdf5da5c99db0f42866385b5
parent77d9f83cc2e8e6afea0a42d0953d3adfaf2769e1 (diff)
downloadrabbitmq-server-cab1334151fcb54c979075742a1441dc3cd63166.tar.gz
reporting of cluster node types now works
-rw-r--r--src/rabbit_mnesia.erl19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index e2b6927f..7e1b8a9f 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -77,7 +77,7 @@ status() ->
{disc, disc_copies},
{ram, ram_copies}],
begin
- Nodes = mnesia:table_info(schema, CopyType),
+ Nodes = nodes_of_type(CopyType),
Nodes =/= []
end];
no -> case mnesia:system_info(db_nodes) of
@@ -144,6 +144,15 @@ empty_ram_only_tables() ->
%%--------------------------------------------------------------------
+nodes_of_type(Type) ->
+ %% This function should return the nodes of a certain type (ram,
+ %% disc or disc_only) in the current cluster. The type of nodes
+ %% is determined when the cluster is initially configured.
+ %% Specifically, we check whether a certain table, which we know
+ %% will be written to disk on a disc node, is stored on disk or in
+ %% RAM.
+ mnesia:table_info(rabbit_durable_exchange, Type).
+
table_definitions() ->
[{rabbit_user,
[{record_name, user},
@@ -175,10 +184,10 @@ table_definitions() ->
[{record_name, reverse_route},
{attributes, record_info(fields, reverse_route)},
{type, ordered_set}]},
- {rabbit_durable_exchange,
- [{record_name, exchange},
- {attributes, record_info(fields, exchange)},
- {disc_copies, [node()]}]},
+ {rabbit_durable_exchange, % if you change this entry,
+ [{record_name, exchange}, % consider the implications
+ {attributes, record_info(fields, exchange)}, % on nodes_of_type/1
+ {disc_copies, [node()]}]}, % <--- this line is particularly important
{rabbit_exchange,
[{record_name, exchange},
{attributes, record_info(fields, exchange)}]},