summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-07-18 14:08:35 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-07-18 14:08:35 +0100
commitd4a7b574c7b4e05a3a913be722f6b715aecf3479 (patch)
tree0b151139b26d5ba7c1fe9ed71638013431b18f9b /src
parentb75241fcd24673243ffe413f9df95899c2e2ecfb (diff)
downloadrabbitmq-server-git-d4a7b574c7b4e05a3a913be722f6b715aecf3479.tar.gz
cover the missing case
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mnesia.erl13
-rw-r--r--src/rabbit_tests.erl4
2 files changed, 10 insertions, 7 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 2db598c965..b38b43c4d1 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -444,15 +444,15 @@ init_db(ClusterNodes, Force, SecondaryPostMnesiaFun) ->
end;
true -> ok
end,
+ if (WasDiskNode andalso (not IsDiskNode)) ->
+ rabbit_log:warning("converting from disc to ram node; backing up database"),
+ move_db();
+ true -> ok
+ end,
%% We create a new db (on disk, or in ram) in the first
%% three cases and attempt to upgrade the in the other two
case {Nodes, WasDiskNode, IsDiskNode} of
- {[], false, false} ->
- ok = create_tables(false),
- ok = rabbit_version:record_desired();
- {[], true, false} ->
- rabbit_log:warning("converting from disc to ram node; backing up database"),
- move_db(),
+ {_, _, false} ->
ok = create_tables(false),
ok = rabbit_version:record_desired();
{[], false, true} ->
@@ -573,6 +573,7 @@ create_tables(IsDiskNode) ->
end,
case mnesia:create_table(Tab, TabDef2) of
{atomic, ok} -> ok;
+ {aborted, {already_exists, Tab}} -> ok;
{aborted, Reason} ->
throw({error, {table_creation_failed,
Tab, TabDef2, Reason}})
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 63676fef64..5118587906 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -904,7 +904,6 @@ test_option_parser() ->
passed.
test_cluster_management() ->
-
%% 'cluster' and 'reset' should only work if the app is stopped
{error, _} = control_action(cluster, []),
{error, _} = control_action(reset, []),
@@ -1014,6 +1013,9 @@ test_cluster_management2(SecondaryNode) ->
"invalid2@invalid"]),
%% turn a disk node into a ram node
+ receive
+ after 1000 -> ok
+ end,
ok = control_action(reset, []),
ok = control_action(cluster, [SecondaryNodeS]),
ok = control_action(start_app, []),