Skip to content

Commit 6ce6cb3

Browse files
Merge pull request #339 from rabbitmq/rabbitmq-server-290
forces GC after queue paging
2 parents 31a4b25 + 6c390df commit 6ce6cb3

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/rabbit_variable_queue.erl

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,19 +1947,23 @@ reduce_memory_use(State = #vqstate {
19471947
State2
19481948
end,
19491949

1950-
case chunk_size(?QUEUE:len(Q2) + ?QUEUE:len(Q3),
1951-
permitted_beta_count(State1)) of
1952-
S2 when S2 >= IoBatchSize ->
1953-
%% There is an implicit, but subtle, upper bound here. We
1954-
%% may shuffle a lot of messages from Q2/3 into delta, but
1955-
%% the number of these that require any disk operation,
1956-
%% namely index writing, i.e. messages that are genuine
1957-
%% betas and not gammas, is bounded by the credit_flow
1958-
%% limiting of the alpha->beta conversion above.
1959-
push_betas_to_deltas(S2, State1);
1960-
_ ->
1961-
State1
1962-
end.
1950+
State3 =
1951+
case chunk_size(?QUEUE:len(Q2) + ?QUEUE:len(Q3),
1952+
permitted_beta_count(State1)) of
1953+
S2 when S2 >= IoBatchSize ->
1954+
%% There is an implicit, but subtle, upper bound here. We
1955+
%% may shuffle a lot of messages from Q2/3 into delta, but
1956+
%% the number of these that require any disk operation,
1957+
%% namely index writing, i.e. messages that are genuine
1958+
%% betas and not gammas, is bounded by the credit_flow
1959+
%% limiting of the alpha->beta conversion above.
1960+
push_betas_to_deltas(S2, State1);
1961+
_ ->
1962+
State1
1963+
end,
1964+
%% See rabbitmq-server-290 for the reasons behind this GC call.
1965+
garbage_collect(),
1966+
State3.
19631967

19641968
limit_ram_acks(0, State) ->
19651969
{0, ui(State)};

0 commit comments

Comments
 (0)