diff options
| author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-07-03 15:10:54 +0100 |
|---|---|---|
| committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-07-03 15:10:54 +0100 |
| commit | 4071897cad67b90bf1efc18d1b37eb95c633e1f9 (patch) | |
| tree | 6182dd3aac6c0c8b52f8f92f89d46160ac571bca /src | |
| parent | 8b43cf3ff563d8c59ea4109c0b79cc748d015bc7 (diff) | |
| download | rabbitmq-server-git-4071897cad67b90bf1efc18d1b37eb95c633e1f9.tar.gz | |
better `rabbit_mnesia:check_cluster_consistency/0'
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mnesia.erl | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index f3cdd6b2ce..04d0d292a0 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -617,40 +617,33 @@ check_cluster_consistency() -> "~s version mismatch: local node is ~s, " "remote node ~s", [Name, This, Remote])}}) end, - CheckOTP = - fun (OTP) -> CheckVsn(erlang:system_info(otp_release), OTP, "OTP") end, - CheckRabbit = - fun (Rabbit) -> - CheckVsn(rabbit_misc:rabbit_version(), Rabbit, "Rabbit") - end, - - CheckNodes = fun (Node, AllNodes) -> - ThisNode = node(), - case lists:member(ThisNode, AllNodes) of - true -> - ok; - false -> - throw({error, - {inconsistent_cluster, - rabbit_misc:format( - "Node ~p thinks it's clustered " - "with node ~p, but ~p disagrees", - [ThisNode, Node, Node])}}) - end - end, lists:foreach( fun(Node) -> case rpc:call(Node, rabbit_mnesia, node_info, []) of {badrpc, _Reason} -> ok; - {OTP, Rabbit, {error, mnesia_not_running}} -> - CheckOTP(OTP), - CheckRabbit(Rabbit); - {OTP, Rabbit, {ok, {AllNodes, _, _}}} -> - CheckOTP(OTP), - CheckRabbit(Rabbit), - CheckNodes(Node, AllNodes) + {OTP, Rabbit, Res} -> + CheckVsn(erlang:system_info(otp_release), OTP, "OTP"), + CheckVsn(rabbit_misc:rabbit_version(), Rabbit, "Rabbit"), + case Res of + {ok, {AllNodes, _, _}} -> + ThisNode = node(), + case lists:member(ThisNode, AllNodes) of + true -> + ok; + false -> + throw( + {error, + {inconsistent_cluster, + rabbit_misc:format( + "Node ~p thinks it's clustered " + "with node ~p, but ~p disagrees", + [ThisNode, Node, Node])}}) + end; + {error, _Reason} -> + ok + end end end, all_clustered_nodes()). |
