summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Majkowski <majek@lshift.net>2009-10-26 13:09:47 -0400
committerMarek Majkowski <majek@lshift.net>2009-10-26 13:09:47 -0400
commit68d168857188d58f9a31c8c58d16825cc01d16c1 (patch)
tree5cdf8cc592703fe4fa334c752ab077165c9acaa6
parent884d689bb1c35ab6dbc38f718328cb29d41eb905 (diff)
parentf280daebf105d43752ff3a1f524c4d39db67c980 (diff)
downloadrabbitmq-server-git-68d168857188d58f9a31c8c58d16825cc01d16c1.tar.gz
Merged default into bug21742.
-rw-r--r--docs/rabbitmqctl.1.pod2
-rw-r--r--src/rabbit_amqqueue_process.erl25
-rw-r--r--src/rabbit_control.erl4
-rw-r--r--src/rabbit_plugin_activator.erl6
4 files changed, 23 insertions, 14 deletions
diff --git a/docs/rabbitmqctl.1.pod b/docs/rabbitmqctl.1.pod
index c43ed2ea25..6b4208725f 100644
--- a/docs/rabbitmqctl.1.pod
+++ b/docs/rabbitmqctl.1.pod
@@ -279,7 +279,7 @@ exchange arguments
=item list_bindings [-p I<vhostpath>]
List bindings by virtual host. Each line printed describes a binding,
-with the exchange name, routing key, queue name and arguments,
+with the exchange name, queue name, routing key and arguments,
separated by tab characters.
=item list_connections [I<connectioninfoitem> ...]
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 3cedfd209c..fad36f2c00 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -314,7 +314,7 @@ should_auto_delete(State) -> is_unused(State).
handle_ch_down(DownPid, State = #q{exclusive_consumer = Holder}) ->
case lookup_ch(DownPid) of
- not_found -> noreply(State);
+ not_found -> {ok, State};
#cr{monitor_ref = MonitorRef, ch_pid = ChPid, txn = Txn,
unacked_messages = UAM} ->
erlang:demonitor(MonitorRef),
@@ -338,8 +338,8 @@ handle_ch_down(DownPid, State = #q{exclusive_consumer = Holder}) ->
blocked_consumers = remove_consumers(
ChPid, State#q.blocked_consumers)}),
case should_auto_delete(NewState) of
- false -> noreply(NewState);
- true -> {stop, normal, NewState}
+ false -> {ok, NewState};
+ true -> {stop, NewState}
end
end.
@@ -593,10 +593,16 @@ handle_call({commit, Txn}, From, State) ->
erase_tx(Txn),
noreply(NewState);
-handle_call({notify_down, ChPid}, From, State) ->
- %% optimisation: we reply straight away so the sender can continue
- gen_server2:reply(From, ok),
- handle_ch_down(ChPid, State);
+handle_call({notify_down, ChPid}, _From, State) ->
+ %% we want to do this synchronously, so that auto_deleted queues
+ %% are no longer visible by the time we send a response to the
+ %% client. The queue is ultimately deleted in terminate/2; if we
+ %% return stop with a reply, terminate/2 will be called by
+ %% gen_server2 *before* the reply is sent.
+ case handle_ch_down(ChPid, State) of
+ {ok, NewState} -> reply(ok, NewState);
+ {stop, NewState} -> {stop, normal, ok, NewState}
+ end;
handle_call({basic_get, ChPid, NoAck}, _From,
State = #q{q = #amqqueue{name = QName},
@@ -876,7 +882,10 @@ handle_info({'DOWN', MonitorRef, process, DownPid, _Reason},
NewState = State#q{owner = none},
{stop, normal, NewState};
handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason}, State) ->
- handle_ch_down(DownPid, State);
+ case handle_ch_down(DownPid, State) of
+ {ok, NewState} -> noreply(NewState);
+ {stop, NewState} -> {stop, normal, NewState}
+ end;
handle_info(Info, State) ->
?LOGDEBUG("Info in queue: ~p~n", [Info]),
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index cc82e727d6..1957972990 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -181,7 +181,7 @@ messages, acks_uncommitted, consumers, transactions, memory]. The default is
auto_delete, arguments]. The default is to display name and type.
The output format for \"list_bindings\" is a list of rows containing
-exchange name, routing key, queue name and arguments, in that order.
+exchange name, queue name, routing key and arguments, in that order.
<ConnectionInfoItem> must be a member of the list [node, address, port,
peer_address, peer_port, state, channels, user, vhost, timeout, frame_max,
@@ -285,7 +285,7 @@ action(list_exchanges, Node, Args, Inform) ->
action(list_bindings, Node, Args, Inform) ->
Inform("Listing bindings", []),
{VHostArg, _} = parse_vhost_flag_bin(Args),
- InfoKeys = [exchange_name, routing_key, queue_name, args],
+ InfoKeys = [exchange_name, queue_name, routing_key, args],
display_info_list(
[lists:zip(InfoKeys, tuple_to_list(X)) ||
X <- rpc_call(Node, rabbit_exchange, list_bindings, [VHostArg])],
diff --git a/src/rabbit_plugin_activator.erl b/src/rabbit_plugin_activator.erl
index f28c4a6ec5..e22d844fdf 100644
--- a/src/rabbit_plugin_activator.erl
+++ b/src/rabbit_plugin_activator.erl
@@ -63,7 +63,7 @@ start() ->
%% applications along the way
AllApps = case catch sets:to_list(expand_dependencies(RequiredApps)) of
{failed_to_load_app, App, Err} ->
- error("failed to load application ~s: ~p", [App, Err]);
+ error("failed to load application ~s:~n~p", [App, Err]);
AppList ->
AppList
end,
@@ -98,14 +98,14 @@ start() ->
end,
ok;
{error, Module, Error} ->
- error("generation of boot script file ~s failed: ~w",
+ error("generation of boot script file ~s failed:~n~s",
[ScriptFile, Module:format_error(Error)])
end,
case post_process_script(ScriptFile) of
ok -> ok;
{error, Reason} ->
- error("post processing of boot script file ~s failed: ~w",
+ error("post processing of boot script file ~s failed:~n~w",
[ScriptFile, Reason])
end,
case systools:script2boot(RootName) of