Skip to content

Commit dc2552b

Browse files
authored
call "add_to_journal" before "maybe_flush_pre_publish_cache"
To reproduce the issue: 1. pre_publish a delivered message. 2. Put its SeqId into delivered_cache, and might call "flush_pre_publish_cache" and "flush_delivered_cache", then put its "del" data into the journal_entries of the corresponding segment. 3. Call add_to_journal and action_to_entry with a "?PUB" Action. 4. in action_to_entry, "array:get(RelSeq, JEntries)" will return {no_pub, del, no_ack}, but has none case for a "?PUB" Action, so an error will occur like "{{case_clause,{no_pub,del,no_ack}},[{rabbit_queue_index,action_to_entry,3..."
1 parent 133d261 commit dc2552b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rabbit_queue_index.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,11 @@ pre_publish(MsgOrId, SeqId, MsgProps, IsPersistent, IsDelivered, JournalSizeHint
349349
DC
350350
end,
351351

352-
add_to_journal(SeqId, {IsPersistent, Bin, MsgBin},
353-
maybe_flush_pre_publish_cache(
352+
State2 = add_to_journal(SeqId, {IsPersistent, Bin, MsgBin}, State1),
353+
maybe_flush_pre_publish_cache(
354354
JournalSizeHint,
355-
State1#qistate{pre_publish_cache = PPC1,
356-
delivered_cache = DC1})).
355+
State2#qistate{pre_publish_cache = PPC1,
356+
delivered_cache = DC1}).
357357

358358
%% pre_publish_cache is the entry with most elements when compared to
359359
%% delivered_cache so we only check the former in the guard.

0 commit comments

Comments
 (0)