summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-07-04 15:57:46 +0100
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-07-04 15:57:46 +0100
commitb426c28811de4813dc9d3b34bda046dd794d485d (patch)
treef008d241bd13f5c34f4e0d8adb1186a7c50a23cc
parent006d5eac31c20f1a6ed4876a2cae2af2319d73f4 (diff)
downloadrabbitmq-server-git-b426c28811de4813dc9d3b34bda046dd794d485d.tar.gz
do not check for consistency when reseting
-rw-r--r--src/rabbit_mnesia.erl30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index d26c5d246c..970495929f 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -214,10 +214,11 @@ reset(Force) ->
all_clustered_nodes();
false ->
AllNodes = all_clustered_nodes(),
- %% Reconnecting so that we will get an up to date nodes
- %% Force=true here so that reset still works when
- %% clustered with a node which is down
- init_db_with_mnesia(AllNodes, is_disc_node(), true),
+ %% Reconnecting so that we will get an up to date nodes.
+ %% We don't need to check for consistency because we are resetting.
+ %% Force=true here so that reset still works when clustered with a
+ %% node which is down.
+ init_db_with_mnesia(AllNodes, is_disc_node(), false, true),
leave_cluster(),
rabbit_misc:ensure_ok(mnesia:delete_schema([Node]),
cannot_delete_schema),
@@ -524,8 +525,8 @@ init_db_and_upgrade(ClusterNodes, WantDiscNode, Force) ->
end,
ok.
-init_db_with_mnesia(ClusterNodes, WantDiscNode, Force) ->
- start_mnesia(),
+init_db_with_mnesia(ClusterNodes, WantDiscNode, CheckConsistency, Force) ->
+ start_mnesia(CheckConsistency),
try
init_db_and_upgrade(ClusterNodes, WantDiscNode, Force)
after
@@ -533,6 +534,9 @@ init_db_with_mnesia(ClusterNodes, WantDiscNode, Force) ->
end,
ensure_mnesia_not_running().
+init_db_with_mnesia(ClusterNodes, WantDiscNode, Force) ->
+ init_db_with_mnesia(ClusterNodes, WantDiscNode, true, Force).
+
ensure_mnesia_dir() ->
MnesiaDir = dir() ++ "/",
case filelib:ensure_dir(MnesiaDir) of
@@ -632,13 +636,13 @@ wait_for_tables(TableNames) ->
%% This does not guarantee us much, but it avoids some situations that will
%% definitely end up badly
check_cluster_consistency() ->
- AllNodes = all_clustered_nodes(),
+ AllNodes = ordsets:del_element(node(), all_clustered_nodes()),
%% We want to find 0 or 1 consistent nodes.
case
lists:foldl(
fun(Node, {error, Error}) ->
case rpc:call(Node, rabbit_mnesia, node_info, []) of
- {badrpc, _Reason} ->
+ {badrpc, Reason} ->
{error, Error};
{OTP, Rabbit, Res} ->
rabbit_misc:sequence_error(
@@ -1032,11 +1036,17 @@ wait_for(Condition) ->
is_only_disc_node(Node) ->
[Node] =:= clustered_disc_nodes().
-start_mnesia() ->
- check_cluster_consistency(),
+start_mnesia(CheckConsistency) ->
+ case CheckConsistency of
+ true -> check_cluster_consistency();
+ false -> ok
+ end,
rabbit_misc:ensure_ok(mnesia:start(), cannot_start_mnesia),
ensure_mnesia_running().
+start_mnesia() ->
+ start_mnesia(true).
+
stop_mnesia() ->
stopped = mnesia:stop(),
ensure_mnesia_not_running().