diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2010-06-16 15:40:27 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2010-06-16 15:40:27 +0100 |
commit | 289a77c4235e920dece255a68bca0f78ef7339b2 (patch) | |
tree | 621dfb1535583855c9d305882b1df9265a3a0741 | |
parent | 36112e315726a7828b2fc1bd81cbfda763ed1f99 (diff) | |
parent | 8c5fcb681a35630897d01a8abc131f7250c29b2e (diff) | |
download | rabbitmq-server-289a77c4235e920dece255a68bca0f78ef7339b2.tar.gz |
Merged heads
-rw-r--r-- | include/rabbit.hrl | 1 | ||||
-rw-r--r-- | src/rabbit.erl | 2 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 4 | ||||
-rw-r--r-- | src/rabbit_mnesia.erl | 18 |
4 files changed, 20 insertions, 5 deletions
diff --git a/include/rabbit.hrl b/include/rabbit.hrl index 0d75310b..06297c69 100644 --- a/include/rabbit.hrl +++ b/include/rabbit.hrl @@ -79,6 +79,7 @@ -type(maybe(T) :: T | 'none'). -type(erlang_node() :: atom()). +-type(node_type() :: disc_only | disc | ram | unknown). -type(ssl_socket() :: #ssl_socket{}). -type(socket() :: port() | ssl_socket()). -type(thunk(T) :: fun(() -> T)). diff --git a/src/rabbit.erl b/src/rabbit.erl index c389178a..6cf6d7d5 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -193,7 +193,7 @@ -spec(rotate_logs/1 :: (file_suffix()) -> 'ok' | {'error', any()}). -spec(status/0 :: () -> [{running_applications, [{atom(), string(), string()}]} | - {nodes, [erlang_node()]} | + {nodes, [{node_type(), [erlang_node()]}]} | {running_nodes, [erlang_node()]}]). -spec(log_location/1 :: ('sasl' | 'kernel') -> log_location()). diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index f4434ade..1ab34f86 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -344,7 +344,7 @@ with_exclusive_access_or_die(QName, ReaderPid, F) -> expand_queue_name_shortcut(<<>>, #ch{ most_recently_declared_queue = <<>> }) -> rabbit_misc:protocol_error( - not_allowed, "no previously declared queue", []); + not_found, "no previously declared queue", []); expand_queue_name_shortcut(<<>>, #ch{ virtual_host = VHostPath, most_recently_declared_queue = MRDQ }) -> rabbit_misc:r(VHostPath, queue, MRDQ); @@ -354,7 +354,7 @@ expand_queue_name_shortcut(QueueNameBin, #ch{ virtual_host = VHostPath }) -> expand_routing_key_shortcut(<<>>, <<>>, #ch{ most_recently_declared_queue = <<>> }) -> rabbit_misc:protocol_error( - not_allowed, "no previously declared queue", []); + not_found, "no previously declared queue", []); expand_routing_key_shortcut(<<>>, <<>>, #ch{ most_recently_declared_queue = MRDQ }) -> MRDQ; diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index a0b7aa4e..d4b29943 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -47,7 +47,8 @@ -ifdef(use_specs). --spec(status/0 :: () -> [{'nodes' | 'running_nodes', [erlang_node()]}]). +-spec(status/0 :: () -> [{'nodes', [{node_type(), [erlang_node()]}]} | + {'running_nodes', [erlang_node()]}]). -spec(dir/0 :: () -> file_path()). -spec(ensure_mnesia_dir/0 :: () -> 'ok'). -spec(init/0 :: () -> 'ok'). @@ -64,7 +65,20 @@ %%---------------------------------------------------------------------------- status() -> - [{nodes, mnesia:system_info(db_nodes)}, + [{nodes, case mnesia:system_info(is_running) of + yes -> [{Key, Nodes} || + {Key, CopyType} <- [{disc_only, disc_only_copies}, + {disc, disc_copies}, + {ram, ram_copies}], + begin + Nodes = mnesia:table_info(schema, CopyType), + Nodes =/= [] + end]; + no -> case mnesia:system_info(db_nodes) of + [] -> []; + Nodes -> [{unknown, Nodes}] + end + end}, {running_nodes, mnesia:system_info(running_db_nodes)}]. init() -> |