summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bridgen <mikeb@rabbitmq.com>2010-08-06 13:07:27 +0100
committerMichael Bridgen <mikeb@rabbitmq.com>2010-08-06 13:07:27 +0100
commit28bc2879895c475cb019d9c89582eeb8685f3d38 (patch)
treeaac009d1cb758054d8e70350da2ad1218bd415b8
parent1388c43f8bebe5a4761700a65dc8c22ddc3e6751 (diff)
parent9b88b8d4f693ead8f5e00ca35c91c96b7b8baad3 (diff)
downloadrabbitmq-server-git-28bc2879895c475cb019d9c89582eeb8685f3d38.tar.gz
Merge heads
-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 c808499b0d..505dc28fe8 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