summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2013-07-04 13:09:41 +0100
committerEmile Joubert <emile@rabbitmq.com>2013-07-04 13:09:41 +0100
commit82d4f1b490756b7649910c821938bd88c5364170 (patch)
tree01e2b9d6b33cbe01aa5ea4279b05183eba2fe02a
parent7531a4d433dfa1537850baa0cf4473736f2befbc (diff)
parentf5a71ecfeec07e99fb1baa5e15de3118d72b6f0a (diff)
downloadrabbitmq-server-git-82d4f1b490756b7649910c821938bd88c5364170.tar.gz
Merged stable into default
-rw-r--r--src/rabbit_mnesia.erl42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 6eda32a361..a0bad8c0a4 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -56,7 +56,8 @@
%% Main interface
-spec(init/0 :: () -> 'ok').
--spec(join_cluster/2 :: (node(), node_type()) -> 'ok').
+-spec(join_cluster/2 :: (node(), node_type())
+ -> 'ok' | {'ok', 'already_member'}).
-spec(reset/0 :: () -> 'ok').
-spec(force_reset/0 :: () -> 'ok').
-spec(update_cluster_nodes/1 :: (node()) -> 'ok').
@@ -164,23 +165,24 @@ join_cluster(DiscoveryNode, NodeType) ->
{error, _} = E -> throw(E)
end,
case me_in_nodes(ClusterNodes) of
- true -> e(already_clustered);
- false -> ok
- end,
-
- %% reset the node. this simplifies things and it will be needed in
- %% this case - we're joining a new cluster with new nodes which
- %% are not in synch with the current node. I also lifts the burden
- %% of reseting the node from the user.
- reset_gracefully(),
-
- %% Join the cluster
- rabbit_misc:local_info_msg("Clustering with ~p as ~p node~n",
- [ClusterNodes, NodeType]),
- ok = init_db_with_mnesia(ClusterNodes, NodeType, true, true),
- rabbit_node_monitor:notify_joined_cluster(),
-
- ok.
+ false ->
+ %% reset the node. this simplifies things and it will be needed in
+ %% this case - we're joining a new cluster with new nodes which
+ %% are not in synch with the current node. I also lifts the burden
+ %% of reseting the node from the user.
+ reset_gracefully(),
+
+ %% Join the cluster
+ rabbit_misc:local_info_msg("Clustering with ~p as ~p node~n",
+ [ClusterNodes, NodeType]),
+ ok = init_db_with_mnesia(ClusterNodes, NodeType, true, true),
+ rabbit_node_monitor:notify_joined_cluster(),
+ ok;
+ true ->
+ rabbit_misc:local_info_msg("Already member of cluster: ~p~n",
+ [ClusterNodes]),
+ {ok, already_member}
+ end.
%% return node to its virgin state, where it is not member of any
%% cluster, has no cluster configuration, no local database, and no
@@ -849,10 +851,6 @@ error_description(clustering_only_disc_node) ->
error_description(resetting_only_disc_node) ->
"You cannot reset a node when it is the only disc node in a cluster. "
"Please convert another node of the cluster to a disc node first.";
-error_description(already_clustered) ->
- "You are already clustered with the nodes you have selected. If the "
- "node you are trying to cluster with is not present in the current "
- "node status, use 'update_cluster_nodes'.";
error_description(not_clustered) ->
"Non-clustered nodes can only be disc nodes.";
error_description(cannot_connect_to_cluster) ->