diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-03-21 19:06:23 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-03-21 19:06:23 +0000 |
commit | d11394235c1874dc8d061e44214aeaf4f81838c1 (patch) | |
tree | 5116ee97f96625113d3f3be1fea8853fa25f0f81 | |
parent | 140a39c16a6d169647d557fb0123a9e9f2d7f6eb (diff) | |
download | rabbitmq-server-d11394235c1874dc8d061e44214aeaf4f81838c1.tar.gz |
So we actually need to handle the case of starting from scratch separately, otherwise we never write out the version file, with fun consequences.bug24810
-rw-r--r-- | src/rabbit_mnesia.erl | 2 | ||||
-rw-r--r-- | src/rabbit_upgrade.erl | 3 | ||||
-rw-r--r-- | src/rabbit_version.erl | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 4d419fd9..c714d3a7 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -508,7 +508,7 @@ init_db(ClusterNodes, Force) -> ok -> ok; %% If we're just starting up a new node we won't have a %% version - version_not_available -> ok = rabbit_version:record_desired() + starting_from_scratch -> ok = rabbit_version:record_desired() end end). diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl index 003accf2..e36ca437 100644 --- a/src/rabbit_upgrade.erl +++ b/src/rabbit_upgrade.erl @@ -124,6 +124,8 @@ maybe_upgrade_mnesia() -> AllNodes = lists:usort(rabbit_mnesia:all_clustered_nodes() ++ rabbit_mnesia:read_cluster_nodes_config()), case rabbit_version:upgrades_required(mnesia) of + {error, starting_from_scratch} -> + ok; {error, version_not_available} -> case AllNodes of [_] -> ok; @@ -238,6 +240,7 @@ nodes_running(Nodes) -> maybe_upgrade_local() -> case rabbit_version:upgrades_required(local) of {error, version_not_available} -> version_not_available; + {error, starting_from_scratch} -> starting_from_scratch; {error, _} = Err -> throw(Err); {ok, []} -> ensure_backup_removed(), ok; diff --git a/src/rabbit_version.erl b/src/rabbit_version.erl index ebc0177e..1cc7d6c8 100644 --- a/src/rabbit_version.erl +++ b/src/rabbit_version.erl @@ -97,7 +97,7 @@ upgrades_required(Scope) -> case recorded_for_scope(Scope) of {error, enoent} -> case filelib:is_file(rabbit_guid:filename()) of - false -> {ok, []}; %% We're blank, no upgrade needed + false -> {error, starting_from_scratch}; true -> {error, version_not_available} end; {ok, CurrentHeads} -> |