Skip to content

Commit 169901d

Browse files
committed
Remove x-queue-mode and restrict x-queue-version to 2
1 parent b97ccfc commit 169901d

File tree

3 files changed

+9
-39
lines changed

3 files changed

+9
-39
lines changed

deps/rabbit/src/rabbit_amqqueue.erl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ declare_args() ->
951951
{<<"x-max-in-memory-bytes">>, fun check_non_neg_int_arg/2},
952952
{<<"x-max-priority">>, fun check_max_priority_arg/2},
953953
{<<"x-overflow">>, fun check_overflow/2},
954-
{<<"x-queue-mode">>, fun check_queue_mode/2},
955954
{<<"x-queue-version">>, fun check_queue_version/2},
956955
{<<"x-single-active-consumer">>, fun check_single_active_consumer_arg/2},
957956
{<<"x-queue-type">>, fun check_queue_type/2},
@@ -1168,32 +1167,14 @@ check_stream_offset_arg(Val, _Args) ->
11681167
{error, {invalid_stream_offset_arg, Val}}
11691168
end.
11701169

1171-
-define(KNOWN_QUEUE_MODES, [<<"default">>, <<"lazy">>]).
1172-
check_queue_mode({longstr, Val}, _Args) ->
1173-
case lists:member(Val, ?KNOWN_QUEUE_MODES) of
1174-
true -> ok;
1175-
false -> {error, rabbit_misc:format("unsupported queue mode '~ts'", [Val])}
1176-
end;
1177-
check_queue_mode({Type, _}, _Args) ->
1178-
{error, {unacceptable_type, Type}};
1179-
check_queue_mode(Val, _Args) when is_binary(Val) ->
1180-
case lists:member(Val, ?KNOWN_QUEUE_MODES) of
1181-
true -> ok;
1182-
false -> {error, rabbit_misc:format("unsupported queue mode '~ts'", [Val])}
1183-
end;
1184-
check_queue_mode(_Val, _Args) ->
1185-
{error, invalid_queue_mode}.
1186-
11871170
check_queue_version({Type, Val}, Args) ->
11881171
case check_non_neg_int_arg({Type, Val}, Args) of
1189-
ok when Val == 1 -> ok;
11901172
ok when Val == 2 -> ok;
11911173
ok -> {error, rabbit_misc:format("unsupported queue version '~b'", [Val])};
11921174
Error -> Error
11931175
end;
11941176
check_queue_version(Val, Args) ->
11951177
case check_non_neg_int_arg(Val, Args) of
1196-
ok when Val == 1 -> ok;
11971178
ok when Val == 2 -> ok;
11981179
ok -> {error, rabbit_misc:format("unsupported queue version '~b'", [Val])};
11991180
Error -> Error

deps/rabbit/test/policy_SUITE.erl

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -222,25 +222,21 @@ queue_type_specific_policies(Config) ->
222222
rabbit_ct_client_helpers:close_connection(Conn),
223223
passed.
224224

225+
%% If we ever introduce a new version after 2, note that a previous
226+
%% version of this test would check policy precedence between versions
227+
%% 1 and 2 in the past, and could easily be restored to handle future cases.
225228
classic_queue_version_policies(Config) ->
226229
[Server | _] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
227230
{Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
228231
QName = <<"policy_queue_version">>,
229232
declare(Ch, QName),
230-
QueueVersionOnePolicy = [{<<"queue-version">>, 1}],
231-
QueueVersionTwoPolicy = [{<<"queue-version">>, 2}],
232-
233-
Opts = #{config => Config,
234-
server => Server,
235-
qname => QName},
236-
237-
%% Queue version OperPolicy has precedence always
238-
verify_policies(QueueVersionOnePolicy, QueueVersionTwoPolicy, QueueVersionTwoPolicy, Opts),
239-
verify_policies(QueueVersionTwoPolicy, QueueVersionOnePolicy, QueueVersionOnePolicy, Opts),
240-
233+
Policy = [{<<"queue-version">>, 2}],
234+
rabbit_ct_broker_helpers:set_policy(Config, 0, <<"policy">>,
235+
QName, <<"queues">>,
236+
Policy),
237+
?assertMatch(2, check_policy_value(Server, QName, <<"queue-version">>)),
241238
delete(Ch, QName),
242239
rabbit_ct_broker_helpers:clear_policy(Config, 0, <<"policy">>),
243-
rabbit_ct_broker_helpers:clear_operator_policy(Config, 0, <<"op_policy">>),
244240
rabbit_ct_client_helpers:close_channel(Ch),
245241
rabbit_ct_client_helpers:close_connection(Conn),
246242
passed.

deps/rabbit/test/priority_queue_SUITE.erl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,23 +391,16 @@ info_head_message_timestamp1(_Config) ->
391391
PQ:delete_and_terminate(a_whim, BQS6),
392392
passed.
393393

394-
%% Because queue version is now ignored, this test is expected
395-
%% to always get a queue version 2.
394+
%% Only queue version 2 can be declared.
396395
info_backing_queue_version(Config) ->
397396
{Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
398-
Q1 = <<"info-priority-queue-v1">>,
399397
Q2 = <<"info-priority-queue-v2">>,
400-
declare(Ch, Q1, [{<<"x-max-priority">>, byte, 3},
401-
{<<"x-queue-version">>, byte, 1}]),
402398
declare(Ch, Q2, [{<<"x-max-priority">>, byte, 3},
403399
{<<"x-queue-version">>, byte, 2}]),
404400
try
405-
{ok, [{backing_queue_status, BQS1}]} = info(Config, Q1, [backing_queue_status]),
406-
2 = proplists:get_value(version, BQS1),
407401
{ok, [{backing_queue_status, BQS2}]} = info(Config, Q2, [backing_queue_status]),
408402
2 = proplists:get_value(version, BQS2)
409403
after
410-
delete(Ch, Q1),
411404
delete(Ch, Q2),
412405
rabbit_ct_client_helpers:close_channel(Ch),
413406
rabbit_ct_client_helpers:close_connection(Conn),

0 commit comments

Comments
 (0)