summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-06 11:40:19 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-06 11:40:19 +0100
commitcfb4ced43a8f02a3ca5518cafde9f44372048128 (patch)
tree8896dca458f3b69f36c8bb64ca2f138c34926c2b /src
parent73db6798274782fd7f8d3a04f40826928d6c8569 (diff)
downloadrabbitmq-server-git-cfb4ced43a8f02a3ca5518cafde9f44372048128.tar.gz
map/filter at the same time
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mnesia.erl24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 5667bae95e..6470dc0ac0 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -233,20 +233,18 @@ ensure_mnesia_not_running() ->
end.
check_schema_integrity() ->
- try TabDefs = table_definitions(),
- TAs = lists:map(fun(Tab) ->
- {_, TabDef} = proplists:lookup(Tab, TabDefs),
- {_, ExpAttrs} = proplists:lookup(attributes, TabDef),
- Attrs = mnesia:table_info(Tab, attributes),
- case ExpAttrs == Attrs of
- true -> ok;
- false -> {table_attributes_mismatch, Tab,
- ExpAttrs, Attrs}
- end
- end, table_names()),
- lists:filter(fun(X) -> X /= ok end, TAs)
+ TabDefs = table_definitions(),
+ try
+ [Failure || Tab <- table_names(),
+ begin
+ {_, TabDef} = proplists:lookup(Tab, TabDefs),
+ {_, ExpAttrs} = proplists:lookup(attributes, TabDef),
+ Attrs = mnesia:table_info(Tab, attributes),
+ Failure = {table_attributes_mismatch, Tab, ExpAttrs, Attrs},
+ Attrs /= ExpAttrs
+ end]
of
- [] -> ok;
+ [] -> ok;
Ps -> {error, Ps}
catch
exit:Reason ->