diff options
author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-09-12 10:52:44 +0100 |
---|---|---|
committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-09-12 10:52:44 +0100 |
commit | 792206ceeb27a39b96413f9dc380120910f937a5 (patch) | |
tree | 77a7137d67eb935d8b7360b3cafb5b613659044d | |
parent | c744654c7db8426329c9f75ec9527431e01862bc (diff) | |
download | rabbitmq-server-792206ceeb27a39b96413f9dc380120910f937a5.tar.gz |
more informative and useful error messages
-rw-r--r-- | src/rabbit_node_monitor.erl | 4 | ||||
-rw-r--r-- | src/rabbit_upgrade.erl | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index c5c70708..0d3423c9 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -90,8 +90,10 @@ running_nodes_file_name() -> filename:join(rabbit_mnesia:dir(), "nodes_running_at_shutdown"). prepare_cluster_status_files() -> + CorruptFiles = fun () -> throw({error, corrupt_cluster_status_files}) end, RunningNodes1 = case try_read_file(running_nodes_file_name()) of {ok, [Nodes]} when is_list(Nodes) -> Nodes; + {ok, _ } -> CorruptFiles(); non_existant -> [] end, {AllNodes1, WantDiscNode} = @@ -100,6 +102,8 @@ prepare_cluster_status_files() -> {AllNodes, lists:member(node(), DiscNodes0)}; {ok, [AllNodes0]} when is_list(AllNodes0) -> {AllNodes0, legacy_should_be_disc_node(AllNodes0)}; + {ok, _} -> + CorruptFiles(); non_existant -> {[], true} end, diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl index c43ce236..3fbfeed0 100644 --- a/src/rabbit_upgrade.erl +++ b/src/rabbit_upgrade.erl @@ -152,12 +152,14 @@ upgrade_mode(AllNodes) -> {true, []} -> primary; {true, _} -> - %% TODO: Here I'm assuming that the various cluster status - %% files are consistent with each other, I think I can - %% provide a solution if they're not... + Filename = rabbit_node_monitor: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.~n", []); + "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.", |