Skip to content

Commit 020b70f

Browse files
committed
Rename quorum queue priority from "low" to "normal"
Rename the two quorum queue priority levels from "low" and "high" to "normal" and "high". This improves user experience because the default priority level is low / normal. Prior to this commit users were confused why their messages show up as low priority. Furthermore there is no need to consult the docs to know whether the default priority level is low or high. (cherry picked from commit 1c6f4be)
1 parent f204af2 commit 020b70f

File tree

5 files changed

+42
-42
lines changed

5 files changed

+42
-42
lines changed

deps/rabbit/src/rabbit_fifo.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ apply(#{index := Idx} = Meta,
316316
credit = increase_credit(Con0, 1)},
317317
State1 = State0#?STATE{ra_indexes = rabbit_fifo_index:delete(OldIdx,
318318
Indexes0),
319-
messages = rabbit_fifo_q:in(lo,
319+
messages = rabbit_fifo_q:in(no,
320320
?MSG(Idx, Header),
321321
Messages),
322322
enqueue_count = EnqCount + 1},
@@ -851,7 +851,7 @@ overview(#?STATE{consumers = Cons,
851851
end,
852852
MsgsRet = lqueue:len(Returns),
853853
#{num_hi := MsgsHi,
854-
num_lo := MsgsLo} = rabbit_fifo_q:overview(Messages),
854+
num_no := MsgsNo} = rabbit_fifo_q:overview(Messages),
855855

856856
Overview = #{type => ?STATE,
857857
config => Conf,
@@ -861,7 +861,7 @@ overview(#?STATE{consumers = Cons,
861861
num_enqueuers => maps:size(Enqs),
862862
num_ready_messages => messages_ready(State),
863863
num_ready_messages_high => MsgsHi,
864-
num_ready_messages_low => MsgsLo,
864+
num_ready_messages_normal => MsgsNo,
865865
num_ready_messages_return => MsgsRet,
866866
num_messages => messages_total(State),
867867
num_release_cursors => 0, %% backwards compat
@@ -2838,10 +2838,10 @@ priority_tag(Msg) ->
28382838
P > 4 ->
28392839
hi;
28402840
_ ->
2841-
lo
2841+
no
28422842
end;
28432843
false ->
2844-
lo
2844+
no
28452845
end.
28462846

28472847

deps/rabbit/src/rabbit_fifo_q.erl

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
%% a weighted priority queue with only two priorities
2020

21-
-record(?MODULE, {hi = ?EMPTY :: {list(msg()), list(msg())},
22-
lo = ?EMPTY :: {list(msg()), list(msg())},
21+
-record(?MODULE, {hi = ?EMPTY :: {list(msg()), list(msg())}, %% high
22+
no = ?EMPTY :: {list(msg()), list(msg())}, %% normal
2323
len = 0 :: non_neg_integer(),
2424
dequeue_counter = 0 :: non_neg_integer()}).
2525

@@ -31,20 +31,20 @@
3131
new() ->
3232
#?MODULE{}.
3333

34-
-spec in(hi | lo, msg(), state()) -> state().
34+
-spec in(hi | no, msg(), state()) -> state().
3535
in(hi, Item, #?MODULE{hi = Hi, len = Len} = State) ->
3636
State#?MODULE{hi = in(Item, Hi),
3737
len = Len + 1};
38-
in(lo, Item, #?MODULE{lo = Lo, len = Len} = State) ->
39-
State#?MODULE{lo = in(Item, Lo),
38+
in(no, Item, #?MODULE{no = No, len = Len} = State) ->
39+
State#?MODULE{no = in(Item, No),
4040
len = Len + 1}.
4141

4242
-spec out(state()) ->
4343
empty | {msg(), state()}.
4444
out(#?MODULE{len = 0}) ->
4545
empty;
4646
out(#?MODULE{hi = Hi0,
47-
lo = Lo0,
47+
no = No0,
4848
len = Len,
4949
dequeue_counter = C0} = State) ->
5050
C = case C0 of
@@ -58,8 +58,8 @@ out(#?MODULE{hi = Hi0,
5858
{Msg, State#?MODULE{hi = drop(Hi0),
5959
dequeue_counter = C,
6060
len = Len - 1}};
61-
{lo, Msg} ->
62-
{Msg, State#?MODULE{lo = drop(Lo0),
61+
{no, Msg} ->
62+
{Msg, State#?MODULE{no = drop(No0),
6363
dequeue_counter = C,
6464
len = Len - 1}}
6565
end.
@@ -78,21 +78,21 @@ len(#?MODULE{len = Len}) ->
7878
-spec from_lqueue(lqueue:lqueue(msg())) -> state().
7979
from_lqueue(LQ) ->
8080
lqueue:fold(fun (Item, Acc) ->
81-
in(lo, Item, Acc)
81+
in(no, Item, Acc)
8282
end, new(), LQ).
8383

8484
-spec get_lowest_index(state()) -> undefined | ra:index().
8585
get_lowest_index(#?MODULE{len = 0}) ->
8686
undefined;
87-
get_lowest_index(#?MODULE{hi = Hi, lo = Lo}) ->
87+
get_lowest_index(#?MODULE{hi = Hi, no = No}) ->
8888
case peek(Hi) of
8989
empty ->
90-
?MSG(LoIdx, _) = peek(Lo),
91-
LoIdx;
90+
?MSG(NoIdx, _) = peek(No),
91+
NoIdx;
9292
?MSG(HiIdx, _) ->
93-
case peek(Lo) of
94-
?MSG(LoIdx, _) ->
95-
min(HiIdx, LoIdx);
93+
case peek(No) of
94+
?MSG(NoIdx, _) ->
95+
min(HiIdx, NoIdx);
9696
empty ->
9797
HiIdx
9898
end
@@ -101,38 +101,38 @@ get_lowest_index(#?MODULE{hi = Hi, lo = Lo}) ->
101101
-spec overview(state()) ->
102102
#{len := non_neg_integer(),
103103
num_hi := non_neg_integer(),
104-
num_lo := non_neg_integer(),
104+
num_no := non_neg_integer(),
105105
lowest_index := ra:index()}.
106106
overview(#?MODULE{len = Len,
107107
hi = {Hi1, Hi2},
108-
lo = _} = State) ->
108+
no = _} = State) ->
109109
%% TODO: this could be very slow with large backlogs,
110-
%% consider keeping a separate counter for hi, lo messages
110+
%% consider keeping a separate counter for 'hi', 'no' messages
111111
NumHi = length(Hi1) + length(Hi2),
112112
#{len => Len,
113113
num_hi => NumHi,
114-
num_lo => Len - NumHi,
114+
num_no => Len - NumHi,
115115
lowest_index => get_lowest_index(State)}.
116116

117117
%% internals
118118

119119
next(#?MODULE{hi = ?NON_EMPTY = Hi,
120-
lo = ?NON_EMPTY = Lo,
120+
no = ?NON_EMPTY = No,
121121
dequeue_counter = ?WEIGHT}) ->
122122
?MSG(HiIdx, _) = HiMsg = peek(Hi),
123-
?MSG(LoIdx, _) = LoMsg = peek(Lo),
123+
?MSG(NoIdx, _) = NoMsg = peek(No),
124124
%% always favour hi priority messages when it is safe to do so,
125-
%% i.e. the index is lower than the next index for the lo queue
126-
case HiIdx < LoIdx of
125+
%% i.e. the index is lower than the next index for the 'no' queue
126+
case HiIdx < NoIdx of
127127
true ->
128128
{hi, HiMsg};
129129
false ->
130-
{lo, LoMsg}
130+
{no, NoMsg}
131131
end;
132132
next(#?MODULE{hi = ?NON_EMPTY = Hi}) ->
133133
{hi, peek(Hi)};
134-
next(#?MODULE{lo = Lo}) ->
135-
{lo, peek(Lo)}.
134+
next(#?MODULE{no = No}) ->
135+
{no, peek(No)}.
136136

137137
%% invariant, if the queue is non empty so is the Out (right) list.
138138
in(X, ?EMPTY) ->

deps/rabbit/src/rabbit_quorum_queue.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,8 @@ handle_tick(QName,
559559
Infos0 = maps:fold(
560560
fun(num_ready_messages_high, V, Acc) ->
561561
[{messages_ready_high, V} | Acc];
562-
(num_ready_messages_low, V, Acc) ->
563-
[{messages_ready_low, V} | Acc];
562+
(num_ready_messages_normal, V, Acc) ->
563+
[{messages_ready_normal, V} | Acc];
564564
(num_ready_messages_return, V, Acc) ->
565565
[{messages_ready_returned, V} | Acc];
566566
(_, _, Acc) ->

deps/rabbit/test/rabbit_fifo_q_SUITE.erl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ basics(_Config) ->
7272
rabbit_fifo_q:in(P, I, Q)
7373
end, Q0, [
7474
{hi, ?MSG(1)},
75-
{lo, ?MSG(2)},
75+
{no, ?MSG(2)},
7676
{hi, ?MSG(3)},
77-
{lo, ?MSG(4)},
77+
{no, ?MSG(4)},
7878
{hi, ?MSG(5)}
7979
]),
8080
{?MSG(1), Q2} = rabbit_fifo_q:out(Q1),
@@ -87,7 +87,7 @@ basics(_Config) ->
8787

8888
hi_is_prioritised(_Config) ->
8989
Q0 = rabbit_fifo_q:new(),
90-
%% when `hi' has a lower index than the next lo then it is still
90+
%% when `hi' has a lower index than the next 'no' then it is still
9191
%% prioritied (as this is safe to do).
9292
Q1 = lists:foldl(
9393
fun ({P, I}, Q) ->
@@ -97,7 +97,7 @@ hi_is_prioritised(_Config) ->
9797
{hi, ?MSG(2)},
9898
{hi, ?MSG(3)},
9999
{hi, ?MSG(4)},
100-
{lo, ?MSG(5)}
100+
{no, ?MSG(5)}
101101
]),
102102
{?MSG(1), Q2} = rabbit_fifo_q:out(Q1),
103103
{?MSG(2), Q3} = rabbit_fifo_q:out(Q2),
@@ -110,8 +110,8 @@ hi_is_prioritised(_Config) ->
110110
get_lowest_index(_Config) ->
111111
Q0 = rabbit_fifo_q:new(),
112112
Q1 = rabbit_fifo_q:in(hi, ?MSG(1, ?LINE), Q0),
113-
Q2 = rabbit_fifo_q:in(lo, ?MSG(2, ?LINE), Q1),
114-
Q3 = rabbit_fifo_q:in(lo, ?MSG(3, ?LINE), Q2),
113+
Q2 = rabbit_fifo_q:in(no, ?MSG(2, ?LINE), Q1),
114+
Q3 = rabbit_fifo_q:in(no, ?MSG(3, ?LINE), Q2),
115115
{_, Q4} = rabbit_fifo_q:out(Q3),
116116
{_, Q5} = rabbit_fifo_q:out(Q4),
117117
{_, Q6} = rabbit_fifo_q:out(Q5),
@@ -129,7 +129,7 @@ get_lowest_index(_Config) ->
129129
single_priority_behaves_like_queue(_Config) ->
130130
run_proper(
131131
fun () ->
132-
?FORALL({P, Ops}, {oneof([hi, lo]), op_gen(256)},
132+
?FORALL({P, Ops}, {oneof([hi, no]), op_gen(256)},
133133
queue_prop(P, Ops))
134134
end, [], 25),
135135
ok.

deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<th class="horizontal">Unacked</th>
133133
<% if (is_quorum(queue)) { %>
134134
<th class="horizontal">High priority</th>
135-
<th class="horizontal">Low priority</th>
135+
<th class="horizontal">Normal priority</th>
136136
<th class="horizontal">Returned</th>
137137
<th class="horizontal">Dead-lettered
138138
<span class="help" id="queue-dead-lettered"></span>
@@ -163,7 +163,7 @@
163163
<%= fmt_num_thousands(queue.messages_ready_high) %>
164164
</td>
165165
<td class="r">
166-
<%= fmt_num_thousands(queue.messages_ready_low) %>
166+
<%= fmt_num_thousands(queue.messages_ready_normal) %>
167167
</td>
168168
<td class="r">
169169
<%= fmt_num_thousands(queue.messages_ready_returned) %>

0 commit comments

Comments
 (0)