diff --git a/deps/rabbit/src/rabbit_priority_queue.erl b/deps/rabbit/src/rabbit_priority_queue.erl index de88deb24f8e..d649773190d5 100644 --- a/deps/rabbit/src/rabbit_priority_queue.erl +++ b/deps/rabbit/src/rabbit_priority_queue.erl @@ -652,7 +652,13 @@ priority_on_acktags(P, AckTags) -> combine_status(P, New, nothing) -> [{priority_lengths, [{P, proplists:get_value(len, New)}]} | New]; combine_status(P, New, Old) -> - Combined = [{K, cse(V, proplists:get_value(K, Old))} || {K, V} <- New], + Combined = [case K of + version -> + {K, proplists:get_value(version, Old)}; + _ -> + {K, cse(V, proplists:get_value(K, Old))} + end + || {K, V} <- New], Lens = [{P, proplists:get_value(len, New)} | proplists:get_value(priority_lengths, Old)], [{priority_lengths, Lens} | Combined]. diff --git a/deps/rabbit/test/priority_queue_SUITE.erl b/deps/rabbit/test/priority_queue_SUITE.erl index 14d5fcc637b5..64fb7b5246ef 100644 --- a/deps/rabbit/test/priority_queue_SUITE.erl +++ b/deps/rabbit/test/priority_queue_SUITE.erl @@ -28,6 +28,7 @@ groups() -> {overflow_reject_publish_dlx, [], [reject]}, dropwhile_fetchwhile, info_head_message_timestamp, + info_backing_queue_version, unknown_info_key, matching, purge, @@ -393,6 +394,27 @@ info_head_message_timestamp1(_Config) -> PQ:delete_and_terminate(a_whim, BQS6), passed. +info_backing_queue_version(Config) -> + {Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0), + Q1 = <<"info-priority-queue-v1">>, + Q2 = <<"info-priority-queue-v2">>, + declare(Ch, Q1, [{<<"x-max-priority">>, byte, 3}, + {<<"x-queue-version">>, byte, 1}]), + declare(Ch, Q2, [{<<"x-max-priority">>, byte, 3}, + {<<"x-queue-version">>, byte, 2}]), + try + {ok, [{backing_queue_status, BQS1}]} = info(Config, Q1, [backing_queue_status]), + 1 = proplists:get_value(version, BQS1), + {ok, [{backing_queue_status, BQS2}]} = info(Config, Q2, [backing_queue_status]), + 2 = proplists:get_value(version, BQS2) + after + delete(Ch, Q1), + delete(Ch, Q2), + rabbit_ct_client_helpers:close_channel(Ch), + rabbit_ct_client_helpers:close_connection(Conn), + passed + end. + unknown_info_key(Config) -> {Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0), Q = <<"info-priority-queue">>,