summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-02-01 13:38:31 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-02-01 13:38:31 +0000
commitf8f46c627d2f0c7c68368bae585820c8dafa2de0 (patch)
tree673878d5b85c8c6c6854eb6254a0c1044b37c28f
parent078e135979f9be3b0acb4f0397f53014da7d670f (diff)
downloadrabbitmq-server-f8f46c627d2f0c7c68368bae585820c8dafa2de0.tar.gz
Change the semantics of Force to fit this particular bug. *meep*.
-rw-r--r--src/rabbit_mnesia.erl18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index a6627116..0dc22914 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -505,22 +505,18 @@ init_db(ClusterNodes, Force) ->
%% Take a cluster node config and create the right kind of node - a
%% standalone disk node, or disk or ram node connected to the
%% specified cluster nodes. If Force is false, don't allow
-%% connections to offline nodes.
+%% connections if all disc nodes are offline and we are a RAM node.
init_db(ClusterNodes, Force, SecondaryPostMnesiaFun) ->
UClusterNodes = lists:usort(ClusterNodes),
ProperClusterNodes = UClusterNodes -- [node()],
case mnesia:change_config(extra_db_nodes, ProperClusterNodes) of
{ok, Nodes} ->
- case Force of
- false -> FailedClusterNodes = ProperClusterNodes -- Nodes,
- case FailedClusterNodes of
- [] -> ok;
- _ -> throw({error, {failed_to_cluster_with,
- FailedClusterNodes,
- "Mnesia could not connect "
- "to some nodes."}})
- end;
- true -> ok
+ case Nodes =:= [] andalso not is_disc_node() andalso not Force of
+ false -> ok;
+ true -> throw({error, {failed_to_cluster_with,
+ ProperClusterNodes,
+ "Mnesia could not connect "
+ "to any disc nodes."}})
end,
WantDiscNode = should_be_disc_node(ClusterNodes),
WasDiscNode = is_disc_node(),