diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2018-05-14 15:06:52 -0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2018-05-14 15:06:52 -0300 |
| commit | 08168de6b0c3c4d7f6429f2c3d098e5080ff7b1a (patch) | |
| tree | 91f65b8dec0f3c078e13437e168698f482bff10d | |
| parent | 44500061d465a8552a07af5a3a519d2263f94f8a (diff) | |
| download | rabbitmq-server-git-08168de6b0c3c4d7f6429f2c3d098e5080ff7b1a.tar.gz | |
Revert "Take policy-configured max-priority into account"
This reverts commit f5aa1fbe043395806d9b9ed8780892924431466c.
This feature wasn't available in the original implementation for a reason:
policies are dynamic and can change after a queue's been declared. However,
queue priorities are (at least currently) set in stone from the moment of
queue creation. This was mentioned in the docs but not explicitly enough and got overlooked.
Credit for the [re-]discovery goes to @acogoluegnes :)
References #1590.
[#157380396]
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 4 | ||||
| -rw-r--r-- | src/rabbit_priority_queue.erl | 18 |
2 files changed, 2 insertions, 20 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 746679168f..a3c8f99519 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -382,7 +382,6 @@ process_args_policy(State = #q{q = Q, {<<"message-ttl">>, fun res_min/2, fun init_ttl/2}, {<<"max-length">>, fun res_min/2, fun init_max_length/2}, {<<"max-length-bytes">>, fun res_min/2, fun init_max_bytes/2}, - {<<"max-priority">>, fun res_arg/2, fun init_max_priority/2}, {<<"overflow">>, fun res_arg/2, fun init_overflow/2}, {<<"queue-mode">>, fun res_arg/2, fun init_queue_mode/2}], drop_expired_msgs( @@ -427,9 +426,6 @@ init_max_bytes(MaxBytes, State) -> {_Dropped, State1} = maybe_drop_head(State#q{max_bytes = MaxBytes}), State1. -init_max_priority(_MaxPriority, State) -> - State. - init_overflow(undefined, State) -> State; init_overflow(Overflow, State) -> diff --git a/src/rabbit_priority_queue.erl b/src/rabbit_priority_queue.erl index 481fd9a390..b1eb83dddc 100644 --- a/src/rabbit_priority_queue.erl +++ b/src/rabbit_priority_queue.erl @@ -28,8 +28,6 @@ {requires, pre_boot}, {enables, kernel_ready}]}). --import(rabbit_misc, [pget/2]). - -export([enable/0]). -export([start/2, stop/1]). @@ -45,8 +43,6 @@ info/2, invoke/3, is_duplicate/2, set_queue_mode/2, zip_msgs_and_acks/4, handle_info/2]). --export([max_priority/1, priorities/1]). - -record(state, {bq, bqss, max_priority}). -record(passthrough, {bq, bqs}). @@ -129,19 +125,9 @@ collapse_recovery(QNames, DupNames, Recovery) -> end, dict:new(), lists:zip(DupNames, Recovery)), [dict:fetch(Name, NameToTerms) || Name <- QNames]. -max_priority(Q = #amqqueue{arguments = Args}) -> - case rabbit_misc:table_lookup(Args, <<"x-max-priority">>) of - {Type, RequestedMax} -> {Type, RequestedMax}; - undefined -> - case rabbit_policy:effective_definition(Q) of - undefined -> undefined; - Proplist -> {unsignedbyte, pget(<<"max-priority">>, Proplist)} - end - end. - -priorities(Q) -> +priorities(#amqqueue{arguments = Args}) -> Ints = [long, short, signedint, byte, unsignedbyte, unsignedshort, unsignedint], - case max_priority(Q) of + case rabbit_misc:table_lookup(Args, <<"x-max-priority">>) of {Type, RequestedMax} -> case lists:member(Type, Ints) of false -> none; |
