summaryrefslogtreecommitdiff
path: root/src/rabbit_variable_queue.erl
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-06-25 12:14:26 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-06-25 12:14:26 +0100
commit52d694ca254671430d325204b1a6ac052377445b (patch)
tree7058d52a88e4b4fb7349a43be431fdacef256f57 /src/rabbit_variable_queue.erl
parentc2698a744b47e24b8ff7fb19b8d574e73792b370 (diff)
downloadrabbitmq-server-52d694ca254671430d325204b1a6ac052377445b.tar.gz
Correct bug. This was introduced in bug 24116.
Diffstat (limited to 'src/rabbit_variable_queue.erl')
-rw-r--r--src/rabbit_variable_queue.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index a167cca0..e1c78307 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -576,10 +576,16 @@ dropwhile1(Pred, State) ->
in_r(MsgStatus = #msg_status { msg = undefined, index_on_disk = IndexOnDisk },
State = #vqstate { q3 = Q3, q4 = Q4, ram_index_count = RamIndexCount }) ->
- true = queue:is_empty(Q4), %% ASSERTION
- State #vqstate {
- q3 = bpqueue:in_r(IndexOnDisk, MsgStatus, Q3),
- ram_index_count = RamIndexCount + one_if(not IndexOnDisk) };
+ case queue:is_empty(Q4) of
+ true ->
+ State #vqstate {
+ q3 = bpqueue:in_r(IndexOnDisk, MsgStatus, Q3),
+ ram_index_count = RamIndexCount + one_if(not IndexOnDisk) };
+ false ->
+ {MsgStatus1, State1 = #vqstate { q4 = Q4a }} =
+ read_msg(MsgStatus, State),
+ State1 #vqstate { q4 = queue:in_r(MsgStatus1, Q4a) }
+ end;
in_r(MsgStatus, State = #vqstate { q4 = Q4 }) ->
State #vqstate { q4 = queue:in_r(MsgStatus, Q4) }.