summaryrefslogtreecommitdiff
path: root/src/rabbit_upgrade.erl
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-07-20 11:07:51 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-07-20 11:07:51 +0100
commit171efe1aca1e1c1aa1de9e9f26409b65bf75c94b (patch)
tree623423a3c44fca9231e2332239800a5fb5ceb816 /src/rabbit_upgrade.erl
parent0fe414015c8640010a7b4e3d2dad7e2a4304a534 (diff)
downloadrabbitmq-server-171efe1aca1e1c1aa1de9e9f26409b65bf75c94b.tar.gz
enable disc-less nodes
The main trouble with this is mnesia:change_config(extra_db_nodes,...). If the current node doesn't have a schema with all the tables created, it will get it from one of the nodes it connects to. This is a problem if we're a disc node and they're a ram node or vice versa. So, after we get the tables from the other node and wait_for_remote_tables, we assert that their storage location is correct and change it if not. If the other node is disc and we are ram, this unfortunately means that the tables are first written to disc and then converted to ram, but since this is a one-off operation during startup, it shouldn't be a problem.
Diffstat (limited to 'src/rabbit_upgrade.erl')
-rw-r--r--src/rabbit_upgrade.erl10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl
index a2abb1e5..e6b52c61 100644
--- a/src/rabbit_upgrade.erl
+++ b/src/rabbit_upgrade.erl
@@ -144,7 +144,7 @@ upgrade_mode(AllNodes) ->
case nodes_running(AllNodes) of
[] ->
AfterUs = rabbit_mnesia:read_previously_running_nodes(),
- case {is_disc_node(), AfterUs} of
+ case {rabbit_mnesia:is_disc_node(), AfterUs} of
{true, []} ->
primary;
{true, _} ->
@@ -182,12 +182,6 @@ upgrade_mode(AllNodes) ->
end
end.
-is_disc_node() ->
- %% This is pretty ugly but we can't start Mnesia and ask it (will hang),
- %% we can't look at the config file (may not include us even if we're a
- %% disc node).
- filelib:is_regular(filename:join(dir(), "rabbit_durable_exchange.DCD")).
-
die(Msg, Args) ->
%% We don't throw or exit here since that gets thrown
%% straight out into do_boot, generating an erl_crash.dump
@@ -218,7 +212,7 @@ force_tables() ->
secondary_upgrade(AllNodes) ->
%% must do this before we wipe out schema
- IsDiscNode = is_disc_node(),
+ IsDiscNode = rabbit_mnesia:is_disc_node(),
rabbit_misc:ensure_ok(mnesia:delete_schema([node()]),
cannot_delete_schema),
%% Note that we cluster with all nodes, rather than all disc nodes