diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-06 11:40:19 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-06 11:40:19 +0100 |
commit | eadcf1446a5cac40b146e6b17f54c397a3b97804 (patch) | |
tree | 8896dca458f3b69f36c8bb64ca2f138c34926c2b | |
parent | 3f1e65c73d12199931d9b88631b990d7df01d7dd (diff) | |
download | rabbitmq-server-eadcf1446a5cac40b146e6b17f54c397a3b97804.tar.gz |
map/filter at the same time
-rw-r--r-- | src/rabbit_mnesia.erl | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 5667bae9..6470dc0a 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 -> |