summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-10-12 15:27:06 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-10-12 15:27:06 +0100
commit5a4066733dc8257372b03255199f5f050d7bd533 (patch)
treebb3e0d9a4cc35eadd485710bba7c1a4a3c7e7274
parent071488bfaada18897cb19ff3e568d837e0260bc4 (diff)
downloadrabbitmq-server-5a4066733dc8257372b03255199f5f050d7bd533.tar.gz
Undo that last change, but still ensure q3 ends on a segment boundary by giving q2 priority over q3 beyond the segment boundary of q3
-rw-r--r--src/rabbit_variable_queue.erl25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 44d7d73c..8e07a0cb 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -1482,18 +1482,11 @@ permitted_beta_count(#vqstate { len = 0 }) ->
infinity;
permitted_beta_count(#vqstate { target_ram_count = 0 }) ->
rabbit_queue_index:next_segment_boundary(0);
-permitted_beta_count(#vqstate { q3 = Q3,
- target_ram_count = TargetRamCount,
+permitted_beta_count(#vqstate { target_ram_count = TargetRamCount,
len = Len }) ->
BetaDelta = lists:max([0, Len - TargetRamCount]),
- Q3SizeLimit =
- case ?QUEUE:peek(Q3) of
- empty ->
- 0;
- {value, #msg_status { seq_id = SeqId }} ->
- rabbit_queue_index:next_segment_boundary(SeqId) - SeqId
- end,
- lists:max([BetaDelta - ((BetaDelta * BetaDelta) div Len), Q3SizeLimit]).
+ lists:max([BetaDelta - ((BetaDelta * BetaDelta) div Len),
+ rabbit_queue_index:next_segment_boundary(0)]).
chunk_size(Current, Permitted)
when Permitted =:= infinity orelse Permitted >= Current ->
@@ -1630,14 +1623,14 @@ push_betas_to_deltas(Quota, State = #vqstate { q2 = Q2,
q3 = Q3,
index_state = IndexState }) ->
PushState = {Quota, Delta, IndexState},
- {Q2a, PushState1} = push_with_limit(
- fun ?QUEUE:out/1,
- fun (Q2MinSeqId) -> Q2MinSeqId end,
- Q2, fun push_betas_to_deltas1/4, PushState),
- {Q3a, PushState2} = push_with_limit(
+ {Q3a, PushState1} = push_with_limit(
fun ?QUEUE:out_r/1,
fun rabbit_queue_index:next_segment_boundary/1,
- Q3, fun push_betas_to_deltas1/4, PushState1),
+ Q3, fun push_betas_to_deltas1/4, PushState),
+ {Q2a, PushState2} = push_with_limit(
+ fun ?QUEUE:out/1,
+ fun (Q2MinSeqId) -> Q2MinSeqId end,
+ Q2, fun push_betas_to_deltas1/4, PushState1),
{_, Delta1, IndexState1} = PushState2,
State #vqstate { q2 = Q2a,
delta = Delta1,