diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-05-18 15:43:51 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-05-18 15:43:51 +0100 |
commit | dd284ed329fe2a0888d5a0df23fd7c5fcff8ba85 (patch) | |
tree | 33f748fa89b632a9881d154006d29bec96fa8382 | |
parent | 6d9e82abd7b035a6e43dfd8ee7dc8d7289843b60 (diff) | |
download | rabbitmq-server-bug24116.tar.gz |
And now, after testing it, actually make it work by correcting one of the counters...bug24116
-rw-r--r-- | src/rabbit_variable_queue.erl | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index d5533e42..8998c0e8 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -567,21 +567,26 @@ dropwhile1(Pred, State) -> internal_queue_out( fun(MsgStatus = #msg_status { msg_props = MsgProps, msg = Msg, index_on_disk = IndexOnDisk }, - State1 = #vqstate { q3 = Q3, q4 = Q4 }) -> + State1 = #vqstate { q3 = Q3, q4 = Q4, + ram_index_count = RamIndexCount }) -> case Pred(MsgProps) of true -> {_, State2} = internal_fetch(false, MsgStatus, State1), dropwhile1(Pred, State2); false -> - case Msg of - undefined -> - true = queue:is_empty(Q4), %% ASSERTION - Q3a = bpqueue:in_r(IndexOnDisk, MsgStatus, Q3), - {ok, State1 #vqstate { q3 = Q3a }}; - _ -> - Q4a = queue:in_r(MsgStatus, Q4), - {ok, State1 #vqstate { q4 = Q4a }} - end + {ok, + case Msg of + undefined -> + true = queue:is_empty(Q4), %% ASSERTION + Q3a = bpqueue:in_r(IndexOnDisk, MsgStatus, Q3), + RamIndexCount1 = + RamIndexCount + one_if(not IndexOnDisk), + State1 #vqstate { + q3 = Q3a, ram_index_count = RamIndexCount1 }; + _ -> + Q4a = queue:in_r(MsgStatus, Q4), + State1 #vqstate { q4 = Q4a } + end} end end, State). |