Skip to content

Commit 79a00a6

Browse files
author
Daniil Fedotov
committed
Rename overflow values to use dashes instead of underscores
1 parent bf531fd commit 79a00a6

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

src/rabbit_amqqueue.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ check_dlxrk_arg({Type, _}, _Args) ->
625625
{error, {unacceptable_type, Type}}.
626626

627627
check_overflow({longstr, Val}, _Args) ->
628-
case lists:member(Val, [<<"drop_head">>, <<"reject_publish">>]) of
628+
case lists:member(Val, [<<"drop-head">>, <<"reject-publish">>]) of
629629
true -> ok;
630630
false -> {error, invalid_overflow}
631631
end;

src/rabbit_amqqueue_process.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
%% max length in bytes, if configured
8181
max_bytes,
8282
%% an action to perform if queue is to be over a limit,
83-
%% can be either drop_head (default) or reject_publish
83+
%% can be either drop-head (default) or reject-publish
8484
overflow,
8585
%% when policies change, this version helps queue
8686
%% determine what previously scheduled/set up state to ignore,
@@ -162,7 +162,7 @@ init_state(Q) ->
162162
msg_id_to_channel = gb_trees:empty(),
163163
status = running,
164164
args_policy_version = 0,
165-
overflow = drop_head},
165+
overflow = 'drop-head'},
166166
rabbit_event:init_stats_timer(State, #q.stats_timer).
167167

168168
init_it(Recover, From, State = #q{q = #amqqueue{exclusive_owner = none}}) ->
@@ -634,9 +634,9 @@ attempt_delivery(Delivery = #delivery{sender = SenderPid,
634634
maybe_deliver_or_enqueue(Delivery, Delivered, State = #q{overflow = Overflow}) ->
635635
send_mandatory(Delivery), %% must do this before confirms
636636
case {will_overflow(Delivery, State), Overflow} of
637-
{true, reject_publish} ->
637+
{true, 'reject-publish'} ->
638638
%% Drop publish and nack to publisher
639-
nack_publish_no_space(Delivery, Delivered, State);
639+
send_reject_publish(Delivery, Delivered, State);
640640
_ ->
641641
%% Enqueue and maybe drop head later
642642
deliver_or_enqueue(Delivery, Delivered, State)
@@ -686,9 +686,9 @@ deliver_or_enqueue(Delivery = #delivery{message = Message,
686686
maybe_drop_head(State = #q{max_length = undefined,
687687
max_bytes = undefined}) ->
688688
{false, State};
689-
maybe_drop_head(State = #q{overflow = reject_publish}) ->
689+
maybe_drop_head(State = #q{overflow = 'reject-publish'}) ->
690690
{false, State};
691-
maybe_drop_head(State = #q{overflow = drop_head}) ->
691+
maybe_drop_head(State = #q{overflow = 'drop-head'}) ->
692692
maybe_drop_head(false, State).
693693

694694
maybe_drop_head(AlreadyDropped, State = #q{backing_queue = BQ,
@@ -707,7 +707,7 @@ maybe_drop_head(AlreadyDropped, State = #q{backing_queue = BQ,
707707
{AlreadyDropped, State}
708708
end.
709709

710-
nack_publish_no_space(#delivery{confirm = true,
710+
send_reject_publish(#delivery{confirm = true,
711711
sender = SenderPid,
712712
msg_seq_no = MsgSeqNo} = Delivery,
713713
_Delivered,
@@ -717,7 +717,7 @@ nack_publish_no_space(#delivery{confirm = true,
717717
{BQS1, MTC1} = discard(Delivery, BQ, BQS, MTC),
718718
gen_server2:cast(SenderPid, {reject_publish, MsgSeqNo, self()}),
719719
State#q{ backing_queue_state = BQS1, msg_id_to_channel = MTC1 };
720-
nack_publish_no_space(#delivery{confirm = false},
720+
send_reject_publish(#delivery{confirm = false},
721721
_Delivered, State) ->
722722
State.
723723

src/rabbit_policies.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ validate_policy0(<<"queue-mode">>, <<"lazy">>) ->
106106
ok;
107107
validate_policy0(<<"queue-mode">>, Value) ->
108108
{error, "~p is not a valid queue-mode value", [Value]};
109-
validate_policy0(<<"overflow">>, <<"drop_head">>) ->
109+
validate_policy0(<<"overflow">>, <<"drop-head">>) ->
110110
ok;
111-
validate_policy0(<<"overflow">>, <<"reject_publish">>) ->
111+
validate_policy0(<<"overflow">>, <<"reject-publish">>) ->
112112
ok;
113113
validate_policy0(<<"overflow">>, Value) ->
114114
{error, "~p is not a valid overflow value", [Value]}.

test/priority_queue_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ reject(Config) ->
311311
{Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
312312
Q = <<"reject-queue">>,
313313
declare(Ch, Q, [{<<"x-max-length">>, long, 4},
314-
{<<"x-overflow">>, longstr, <<"reject_publish">>}
314+
{<<"x-overflow">>, longstr, <<"reject-publish">>}
315315
| arguments(3)]),
316316
publish(Ch, Q, [1, 2, 3, 1, 2, 3, 1, 2, 3]),
317317
%% First 4 messages are published, all others are discarded.

test/simple_ha_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ rejecets_survive(Config, DeathFun) ->
230230
auto_delete = false,
231231
durable = true,
232232
arguments = [{<<"x-max-length">>, long, 1},
233-
{<<"x-overflow">>, longstr, <<"reject_publish">>}]}),
233+
{<<"x-overflow">>, longstr, <<"reject-publish">>}]}),
234234
Payload = <<"there can be only one">>,
235235
amqp_channel:call(Node1Channel,
236236
#'basic.publish'{routing_key = Queue},

test/unit_inbroker_parallel_SUITE.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ max_length_drop_head(Config) ->
10501050

10511051
MaxLengthArgs = [{<<"x-max-length">>, long, 1}],
10521052
MaxLengthBytesArgs = [{<<"x-max-length-bytes">>, long, 100}],
1053-
OverflowArgs = [{<<"x-overflow">>, longstr, <<"drop_head">>}],
1053+
OverflowArgs = [{<<"x-overflow">>, longstr, <<"drop-head">>}],
10541054
amqp_channel:call(Ch, #'queue.delete'{queue = QName}),
10551055
amqp_channel:call(Ch, #'queue.delete'{queue = QNameDefault}),
10561056
amqp_channel:call(Ch, #'queue.delete'{queue = QNameBytes}),
@@ -1076,7 +1076,7 @@ max_length_reject_confirm(Config) ->
10761076
QNameBytes = <<"max_length_bytes_reject_queue">>,
10771077
MaxLengthArgs = [{<<"x-max-length">>, long, 1}],
10781078
MaxLengthBytesArgs = [{<<"x-max-length-bytes">>, long, 100}],
1079-
OverflowArgs = [{<<"x-overflow">>, longstr, <<"reject_publish">>}],
1079+
OverflowArgs = [{<<"x-overflow">>, longstr, <<"reject-publish">>}],
10801080
amqp_channel:call(Ch, #'queue.delete'{queue = QName}),
10811081
amqp_channel:call(Ch, #'queue.delete'{queue = QNameBytes}),
10821082
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QName, arguments = MaxLengthArgs ++ OverflowArgs}),
@@ -1099,12 +1099,12 @@ max_length_drop_publish(Config) ->
10991099
QNameBytes = <<"max_length_bytes_drop_publish_queue">>,
11001100
MaxLengthArgs = [{<<"x-max-length">>, long, 1}],
11011101
MaxLengthBytesArgs = [{<<"x-max-length-bytes">>, long, 100}],
1102-
OverflowArgs = [{<<"x-overflow">>, longstr, <<"reject_publish">>}],
1102+
OverflowArgs = [{<<"x-overflow">>, longstr, <<"reject-publish">>}],
11031103
amqp_channel:call(Ch, #'queue.delete'{queue = QName}),
11041104
amqp_channel:call(Ch, #'queue.delete'{queue = QNameBytes}),
11051105
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QName, arguments = MaxLengthArgs ++ OverflowArgs}),
11061106
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QNameBytes, arguments = MaxLengthBytesArgs ++ OverflowArgs}),
1107-
%% If confirms are not enable, publishes will still be dropped in reject_publish mode.
1107+
%% If confirms are not enable, publishes will still be dropped in reject-publish mode.
11081108
check_max_length_drops_publish(Config, QName, Ch, <<"1">>, <<"2">>, <<"3">>),
11091109

11101110
%% 80 bytes payload

0 commit comments

Comments
 (0)