summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-05-10 15:46:12 +0100
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-05-10 15:46:12 +0100
commit3e4193fb5f489c1bea3a84fb296adb6c332bea3b (patch)
tree81b38999457a4873bc2cfb22eb47806dca698dea
parent01abd002e39cce91137a5eecdc2b45cd7cb2464b (diff)
downloadrabbitmq-server-git-3e4193fb5f489c1bea3a84fb296adb6c332bea3b.tar.gz
removed `rabbit_mnesia:force_cluster'
I'll also have to remove the `Force' parameter from `init_db', fixing bug 24815.
-rw-r--r--src/rabbit_control.erl6
-rw-r--r--src/rabbit_mnesia.erl30
2 files changed, 7 insertions, 29 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index 2dea2a2f34..74581e1511 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -186,12 +186,6 @@ action(cluster, Node, ClusterNodeSs, _Opts, Inform) ->
[Node, ClusterNodes]),
rpc_call(Node, rabbit_mnesia, cluster, [ClusterNodes]);
-action(force_cluster, Node, ClusterNodeSs, _Opts, Inform) ->
- ClusterNodes = lists:map(fun list_to_atom/1, ClusterNodeSs),
- Inform("Forcefully clustering node ~p with ~p (ignoring offline nodes)",
- [Node, ClusterNodes]),
- rpc_call(Node, rabbit_mnesia, force_cluster, [ClusterNodes]);
-
action(wait, Node, [PidFile], _Opts, Inform) ->
Inform("Waiting for ~p", [Node]),
wait_for_application(Node, PidFile, rabbit, Inform);
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index a120b9a33c..f8533b0481 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -18,8 +18,8 @@
-module(rabbit_mnesia).
-export([ensure_mnesia_dir/0, dir/0, status/0, init/0, is_db_empty/0,
- cluster/1, force_cluster/1, reset/0, force_reset/0, init_db/3,
- is_clustered/0, running_clustered_nodes/0, all_clustered_nodes/0,
+ cluster/1, reset/0, force_reset/0, init_db/3, is_clustered/0,
+ running_clustered_nodes/0, all_clustered_nodes/0,
empty_ram_only_tables/0, copy_db/1, wait_for_tables/1,
create_cluster_nodes_config/1, read_cluster_nodes_config/0,
record_running_nodes/0, read_previously_running_nodes/0,
@@ -49,8 +49,6 @@
-spec(init_db/3 :: ([node()], boolean(), boolean()) -> 'ok').
-spec(is_db_empty/0 :: () -> boolean()).
-spec(cluster/1 :: ([node()]) -> 'ok').
--spec(force_cluster/1 :: ([node()]) -> 'ok').
--spec(cluster/2 :: ([node()], boolean()) -> 'ok').
-spec(reset/0 :: () -> 'ok').
-spec(force_reset/0 :: () -> 'ok').
-spec(is_clustered/0 :: () -> boolean()).
@@ -110,26 +108,17 @@ is_db_empty() ->
lists:all(fun (Tab) -> mnesia:dirty_first(Tab) == '$end_of_table' end,
table_names()).
-cluster(ClusterNodes) ->
- cluster(ClusterNodes, false).
-force_cluster(ClusterNodes) ->
- cluster(ClusterNodes, true).
-
%% Alter which disk nodes this node is clustered with. This can be a
%% subset of all the disk nodes in the cluster but can (and should)
%% include the node itself if it is to be a disk rather than a ram
%% node. If Force is false, only connections to online nodes are
%% allowed.
-cluster(ClusterNodes, Force) ->
- rabbit_misc:local_info_msg("Clustering with ~p~s~n",
- [ClusterNodes, if Force -> " forcefully";
- true -> ""
- end]),
+cluster(ClusterNodes) ->
+ rabbit_misc:local_info_msg("Clustering with ~p~s~n", [ClusterNodes]),
ensure_mnesia_not_running(),
ensure_mnesia_dir(),
- case not Force andalso is_clustered() andalso
- is_only_disc_node(node(), false) andalso
+ case is_clustered() andalso is_only_disc_node(node(), false) andalso
not should_be_disc_node(ClusterNodes)
of
true -> log_both("last running disc node leaving cluster");
@@ -164,17 +153,12 @@ cluster(ClusterNodes, Force) ->
%% before we can join it. But, since we don't know if we're in a
%% cluster or not, we just pre-emptively leave it before joining.
ProperClusterNodes = ClusterNodes -- [node()],
- try
- ok = leave_cluster(ProperClusterNodes, ProperClusterNodes)
- catch
- {error, {no_running_cluster_nodes, _, _}} when Force ->
- ok
- end,
+ ok = leave_cluster(ProperClusterNodes, ProperClusterNodes),
%% Join the cluster
start_mnesia(),
try
- ok = init_db(ClusterNodes, Force),
+ ok = init_db(ClusterNodes, false),
ok = create_cluster_nodes_config(ClusterNodes)
after
stop_mnesia()