Skip to content

Commit

Permalink
Merge pull request #3286 from rabbitmq/mergify/bp/v3.8.x/pr-3284
Browse files Browse the repository at this point in the history
Revert "CQ: don't deliver right before acking in the index" (backport #3284)
  • Loading branch information
michaelklishin committed Aug 9, 2021
2 parents ec344ef + e63d89a commit c508eba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions deps/rabbit/src/rabbit_queue_index.erl
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,9 @@ action_to_entry(RelSeq, Action, JEntries) ->
end};
({Pub, no_del, no_ack}) when Action == del ->
{set, {Pub, del, no_ack}};
({no_pub, _del, no_ack}) when Action == ack ->
({no_pub, del, no_ack}) when Action == ack ->
{set, {no_pub, del, ack}};
({?PUB, _del, no_ack}) when Action == ack ->
({?PUB, del, no_ack}) when Action == ack ->
{reset, none}
end.

Expand Down
11 changes: 6 additions & 5 deletions deps/rabbit/src/rabbit_variable_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1774,21 +1774,22 @@ purge_betas_and_deltas(DelsAndAcksFun, State = #vqstate { mode = Mode }) ->

remove_queue_entries(Q, DelsAndAcksFun,
State = #vqstate{msg_store_clients = MSCState}) ->
{MsgIdsByStore, Acks, State1} =
{MsgIdsByStore, Delivers, Acks, State1} =
?QUEUE:foldl(fun remove_queue_entries1/2,
{maps:new(), [], State}, Q),
{maps:new(), [], [], State}, Q),
remove_msgs_by_id(MsgIdsByStore, MSCState),
DelsAndAcksFun([], Acks, State1).
DelsAndAcksFun(Delivers, Acks, State1).

remove_queue_entries1(
#msg_status { msg_id = MsgId, seq_id = SeqId,
#msg_status { msg_id = MsgId, seq_id = SeqId, is_delivered = IsDelivered,
msg_in_store = MsgInStore, index_on_disk = IndexOnDisk,
is_persistent = IsPersistent} = MsgStatus,
{MsgIdsByStore, Acks, State}) ->
{MsgIdsByStore, Delivers, Acks, State}) ->
{case MsgInStore of
true -> rabbit_misc:maps_cons(IsPersistent, MsgId, MsgIdsByStore);
false -> MsgIdsByStore
end,
cons_if(IndexOnDisk andalso not IsDelivered, SeqId, Delivers),
cons_if(IndexOnDisk, SeqId, Acks),
stats({-1, 0}, {MsgStatus, none}, 0, State)}.

Expand Down

0 comments on commit c508eba

Please sign in to comment.