summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mnesia.erl24
-rw-r--r--src/rabbit_upgrade.erl6
2 files changed, 19 insertions, 11 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 35dfc31399..2a04dfe2db 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -46,7 +46,7 @@
-spec(dir/0 :: () -> file:filename()).
-spec(ensure_mnesia_dir/0 :: () -> 'ok').
-spec(init/0 :: () -> 'ok').
--spec(init_db/2 :: ([node()], boolean()) -> 'ok').
+-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').
@@ -505,11 +505,13 @@ delete_previously_running_nodes() ->
FileName, Reason}})
end.
+init_db(ClusterNodes, Force) -> init_db(ClusterNodes, Force, true).
+
%% 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.
-init_db(ClusterNodes, Force) ->
+init_db(ClusterNodes, Force, Upgrade) ->
UClusterNodes = lists:usort(ClusterNodes),
ProperClusterNodes = UClusterNodes -- [node()],
case mnesia:change_config(extra_db_nodes, ProperClusterNodes) of
@@ -547,12 +549,18 @@ init_db(ClusterNodes, Force) ->
ok = create_local_table_copy(schema, CopyTypeAlt),
ok = create_local_table_copies(CopyType),
- ok = case rabbit_upgrade:maybe_upgrade_local() of
- ok -> ok;
- %% If we're just starting up a new node we won't
- %% have a version
- starting_from_scratch ->
- rabbit_version:record_desired()
+ ok = case Upgrade of
+ true ->
+ case rabbit_upgrade:maybe_upgrade_local() of
+ ok ->
+ ok;
+ %% If we're just starting up a new node we
+ %% won't have a version
+ starting_from_scratch ->
+ rabbit_version:record_desired()
+ end;
+ false ->
+ ok
end,
%% We've taken down mnesia, so ram nodes will need
diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl
index d5fa0d69ee..25efb91a13 100644
--- a/src/rabbit_upgrade.erl
+++ b/src/rabbit_upgrade.erl
@@ -66,11 +66,11 @@
%% into the boot process by prelaunch before the mnesia application is
%% started. By the time Mnesia is started the upgrades have happened
%% (on the primary), or Mnesia has been reset (on the secondary) and
-%% rabbit_mnesia:init_db/2 can then make the node rejoin the cluster
+%% rabbit_mnesia:init_db/3 can then make the node rejoin the cluster
%% in the normal way.
%%
%% The non-mnesia upgrades are then triggered by
-%% rabbit_mnesia:init_db/2. Of course, it's possible for a given
+%% rabbit_mnesia:init_db/3. Of course, it's possible for a given
%% upgrade process to only require Mnesia upgrades, or only require
%% non-Mnesia upgrades. In the latter case no Mnesia resets and
%% reclusterings occur.
@@ -230,7 +230,7 @@ secondary_upgrade(AllNodes) ->
false -> AllNodes -- [node()]
end,
rabbit_misc:ensure_ok(mnesia:start(), cannot_start_mnesia),
- ok = rabbit_mnesia:init_db(ClusterNodes, true),
+ ok = rabbit_mnesia:init_db(ClusterNodes, true, false),
ok = rabbit_version:record_desired_for_scope(mnesia),
ok.