diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-07-22 16:18:58 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-07-22 16:18:58 +0100 |
commit | 18539d5367da128fcd48909ee7414a57e20a44a1 (patch) | |
tree | 95b6b0f8f008a33a248ace30c85f9ff451ca948d /src/rabbit_upgrade.erl | |
parent | 89658c418ac65e97aae012dc2b379fc28b092167 (diff) | |
download | rabbitmq-server-18539d5367da128fcd48909ee7414a57e20a44a1.tar.gz |
use mnesia:system_config(use_dir)
Diffstat (limited to 'src/rabbit_upgrade.erl')
-rw-r--r-- | src/rabbit_upgrade.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl index e6b52c61..a6d04f7e 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 {rabbit_mnesia:is_disc_node(), AfterUs} of + case {is_disc_node(), AfterUs} of {true, []} -> primary; {true, _} -> @@ -212,7 +212,7 @@ force_tables() -> secondary_upgrade(AllNodes) -> %% must do this before we wipe out schema - IsDiscNode = rabbit_mnesia:is_disc_node(), + IsDiscNode = 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 @@ -276,6 +276,14 @@ lock_filename() -> lock_filename(dir()). lock_filename(Dir) -> filename:join(Dir, ?LOCK_FILENAME). backup_dir() -> dir() ++ "-upgrade-backup". +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). We also can't use + %% rabbit_mnesia:is_disc_node/0 because that will give false + %% postivies on Rabbit up to 2.5.1. + filelib:is_regular(filename:join(dir(), "rabbit_durable_exchange.DCD")). + %% NB: we cannot use rabbit_log here since it may not have been %% started yet info(Msg, Args) -> error_logger:info_msg(Msg, Args). |