summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-08-06 12:59:10 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-08-06 12:59:10 +0100
commit0c51c168005de52b6267b578e6f3c917aca8bad8 (patch)
treeddab002a6977813252e05c5acc7074e91bb82064
parentbf0d78abd2f6757f054dcb06048f6a7eabade0f4 (diff)
parent069d5a7a5b12b86c14d5c3da23d684b3ae9c1a6b (diff)
downloadrabbitmq-server-0c51c168005de52b6267b578e6f3c917aca8bad8.tar.gz
merge bug23083 into default
-rw-r--r--src/rabbit_mnesia.erl24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index c808499b..505dc28f 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -167,7 +167,8 @@ table_definitions() ->
{attributes, record_info(fields, vhost)},
{disc_copies, [node()]}]},
{rabbit_config,
- [{disc_copies, [node()]}]},
+ [{attributes, [key, val]}, % same mnesia's default
+ {disc_copies, [node()]}]},
{rabbit_listener,
[{record_name, listener},
{attributes, record_info(fields, listener)},
@@ -232,10 +233,23 @@ ensure_mnesia_not_running() ->
end.
check_schema_integrity() ->
- %%TODO: more thorough checks
- case catch [mnesia:table_info(Tab, version) || Tab <- table_names()] of
- {'EXIT', Reason} -> {error, Reason};
- _ -> ok
+ TabDefs = table_definitions(),
+ Tables = mnesia:system_info(tables),
+ case [Error || Tab <- table_names(),
+ case lists:member(Tab, Tables) of
+ false ->
+ Error = {table_missing, Tab},
+ true;
+ true ->
+ {_, TabDef} = proplists:lookup(Tab, TabDefs),
+ {_, ExpAttrs} = proplists:lookup(attributes, TabDef),
+ Attrs = mnesia:table_info(Tab, attributes),
+ Error = {table_attributes_mismatch, Tab,
+ ExpAttrs, Attrs},
+ Attrs /= ExpAttrs
+ end] of
+ [] -> ok;
+ Errors -> {error, Errors}
end.
%% The cluster node config file contains some or all of the disk nodes