diff options
| author | Matthew Sackman <matthew@lshift.net> | 2010-01-16 18:24:04 +0000 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2010-01-16 18:24:04 +0000 |
| commit | d1a303c7f424be55f03b3adc4e8e7e8a2067fd6d (patch) | |
| tree | f364678ac0c3953ff2519f7dd738870df9304059 | |
| parent | e6f2d6fabaa90f576feaa46ee6b2640aec1c7f4a (diff) | |
| download | rabbitmq-server-git-d1a303c7f424be55f03b3adc4e8e7e8a2067fd6d.tar.gz | |
Inability to do basic maths
| -rw-r--r-- | src/rabbit_variable_queue.erl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index 765d01a4d7..58e3f5a377 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -579,21 +579,23 @@ combine_deltas(#delta { start_seq_id = SeqIdLow, count = CountLow}, #delta { start_seq_id = SeqIdLow, count = Count, end_seq_id = SeqIdEnd }. beta_fold_no_index_on_disk(Fun, Init, Q) -> - bpqueue:fold(fun (_Prefix, Value, Acc) -> - Fun(Value, Acc) - end, Init, Q). + bpqueue:foldr(fun (_Prefix, Value, Acc) -> + Fun(Value, Acc) + end, Init, Q). permitted_ram_index_count(#vqstate { len = 0 }) -> undefined; permitted_ram_index_count(#vqstate { len = Len, q2 = Q2, q3 = Q3, delta = #delta { count = DeltaCount } }) -> - case bpqueue:len(Q2) + bpqueue:len(Q3) of - 0 -> + AlphaBetaLen = Len - DeltaCount, + case AlphaBetaLen == 0 of + true -> undefined; - BetaLength -> - %% the fraction of the queue that are betas - BetaFrac = BetaLength / (Len - DeltaCount), - BetaLength - trunc(BetaFrac * BetaLength) + false -> + BetaLen = bpqueue:len(Q2) + bpqueue:len(Q3), + %% the fraction of the alphas+betas that are betas + BetaFrac = BetaLen / AlphaBetaLen, + BetaLen - trunc(BetaFrac * BetaLen) end. |
