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 | b88324d62b465f7c1eac86edf2178d05c1c1dc52 (patch) | |
| tree | 33f748fa89b632a9881d154006d29bec96fa8382 | |
| parent | ff11ce2755d725c3d798abd0a3e544f803a345e0 (diff) | |
| download | rabbitmq-server-git-b88324d62b465f7c1eac86edf2178d05c1c1dc52.tar.gz | |
And now, after testing it, actually make it work by correcting one of the counters...
| -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 d5533e4222..8998c0e860 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). |
