summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-03-23 16:05:04 +0000
committerSimon MacMullen <simon@rabbitmq.com>2011-03-23 16:05:04 +0000
commitc63dcaa034093cd1dc217c06c102127d18ac524f (patch)
treee13a0a7645195e2c306bff3936aef441093eb109
parent49025c80d9eb23f59615f6a92522d48aee5bbd3a (diff)
downloadrabbitmq-server-c63dcaa034093cd1dc217c06c102127d18ac524f.tar.gz
Record all nodes, don't list them when we refuse to start.
-rw-r--r--src/rabbit.erl4
-rw-r--r--src/rabbit_mnesia.erl21
-rw-r--r--src/rabbit_upgrade.erl15
3 files changed, 17 insertions, 23 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 1361d0f4..e60886fa 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -233,7 +233,7 @@ rotate_logs(BinarySuffix) ->
start(normal, []) ->
case erts_version_check() of
ok ->
- ok = rabbit_mnesia:delete_previously_running_disc_nodes(),
+ ok = rabbit_mnesia:delete_previously_running_nodes(),
{ok, SupPid} = rabbit_sup:start_link(),
true = register(rabbit, self()),
@@ -246,7 +246,7 @@ start(normal, []) ->
end.
stop(_State) ->
- ok = rabbit_mnesia:record_running_disc_nodes(),
+ ok = rabbit_mnesia:record_running_nodes(),
terminated_ok = error_logger:delete_report_handler(rabbit_error_logger),
ok = rabbit_alarm:stop(),
ok = case rabbit_mnesia:is_clustered() of
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 47df1148..e661e5e3 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -22,8 +22,8 @@
is_clustered/0, running_clustered_nodes/0, all_clustered_nodes/0,
empty_ram_only_tables/0, copy_db/1, wait_for_tables/1,
create_cluster_nodes_config/1, read_cluster_nodes_config/0,
- record_running_disc_nodes/0, read_previously_running_disc_nodes/0,
- delete_previously_running_disc_nodes/0, running_nodes_filename/0]).
+ record_running_nodes/0, read_previously_running_nodes/0,
+ delete_previously_running_nodes/0, running_nodes_filename/0]).
-export([table_names/0]).
@@ -61,9 +61,9 @@
-spec(wait_for_tables/1 :: ([atom()]) -> 'ok').
-spec(create_cluster_nodes_config/1 :: ([node()]) -> 'ok').
-spec(read_cluster_nodes_config/0 :: () -> [node()]).
--spec(record_running_disc_nodes/0 :: () -> 'ok').
--spec(read_previously_running_disc_nodes/0 :: () -> [node()]).
--spec(delete_previously_running_disc_nodes/0 :: () -> 'ok').
+-spec(record_running_nodes/0 :: () -> 'ok').
+-spec(read_previously_running_nodes/0 :: () -> [node()]).
+-spec(delete_previously_running_nodes/0 :: () -> 'ok').
-spec(running_nodes_filename/0 :: () -> file:filename()).
-endif.
@@ -380,18 +380,15 @@ delete_cluster_nodes_config() ->
running_nodes_filename() ->
filename:join(dir(), "nodes_running_at_shutdown").
-record_running_disc_nodes() ->
+record_running_nodes() ->
FileName = running_nodes_filename(),
- Nodes = sets:to_list(
- sets:intersection(
- sets:from_list(nodes_of_type(disc_copies)),
- sets:from_list(running_clustered_nodes()))) -- [node()],
+ Nodes = running_clustered_nodes() -- [node()],
%% Don't check the result: we're shutting down anyway and this is
%% a best-effort-basis.
rabbit_misc:write_term_file(FileName, [Nodes]),
ok.
-read_previously_running_disc_nodes() ->
+read_previously_running_nodes() ->
FileName = running_nodes_filename(),
case rabbit_misc:read_term_file(FileName) of
{ok, [Nodes]} -> Nodes;
@@ -400,7 +397,7 @@ read_previously_running_disc_nodes() ->
FileName, Reason}})
end.
-delete_previously_running_disc_nodes() ->
+delete_previously_running_nodes() ->
FileName = running_nodes_filename(),
case file:delete(FileName) of
ok -> ok;
diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl
index 6959208b..244be522 100644
--- a/src/rabbit_upgrade.erl
+++ b/src/rabbit_upgrade.erl
@@ -144,7 +144,7 @@ maybe_upgrade_mnesia() ->
upgrade_mode(AllNodes) ->
case nodes_running(AllNodes) of
[] ->
- AfterUs = rabbit_mnesia:read_previously_running_disc_nodes(),
+ AfterUs = rabbit_mnesia:read_previously_running_nodes(),
case {is_disc_node(), AfterUs} of
{true, []} ->
primary;
@@ -152,14 +152,11 @@ upgrade_mode(AllNodes) ->
Filename = rabbit_mnesia:running_nodes_filename(),
die("Cluster upgrade needed but other disc nodes shut "
"down after this one.~nPlease first start the last "
- "disc node to shut down.~nThe disc nodes that were "
- "still running when this one shut down are:~n~n"
- " ~p~n~nNote: if several disc nodes were shut down "
- "simultaneously they may all~nshow this message. "
- "In which case, remove the lock file on one of them "
- "and~nstart that node. The lock file on this node "
- "is:~n~n ~s ",
- [AfterUs, Filename]);
+ "disc node to shut down.~n~nNote: if several disc "
+ "nodes were shut down simultaneously they may "
+ "all~nshow this message. In which case, remove "
+ "the lock file on one of them and~nstart that node. "
+ "The lock file on this node is:~n~n ~s ", [Filename]);
{false, _} ->
die("Cluster upgrade needed but this is a ram node.~n"
"Please first start the last disc node to shut down.",