Skip to content

Commit 53336d2

Browse files
the-mikedavismergify[bot]
authored andcommitted
rabbit_fifo: Expose each smallest raft index in overview/1
This is meant to be used as a debugging tool via an eval command. It can be hard to tell from the outside why a QQ is not snapshotting. Looking at the `overview/1` is a nice debugging tool. The `smallest_raft_index` key (and other keys like the `release_cursors`) points out why a snapshot isn't being taken. The `smallest_raft_index` is the minimum of three criteria though: * oldest ready message * oldest checked out message * oldest message in the dlx state This change adds all of those indexes so that it is clear which criteria is keeping the `smallest_raft_index` down. (cherry picked from commit 7f36b01) (cherry picked from commit c59e4ef)
1 parent ff93f2c commit 53336d2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

deps/rabbit/src/rabbit_fifo.erl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,8 @@ overview(#?STATE{consumers = Cons,
911911
in_memory_message_bytes => 0, %% backwards compat
912912
num_in_memory_ready_messages => 0, %% backwards compat
913913
release_cursor_enqueue_counter => EnqCount,
914-
smallest_raft_index => smallest_raft_index(State)
914+
smallest_raft_index => smallest_raft_index(State),
915+
smallest_raft_index_overview => smallest_raft_index_overview(State)
915916
},
916917
DlxOverview = rabbit_fifo_dlx:overview(DlxState),
917918
maps:merge(maps:merge(Overview, DlxOverview), SacOverview).
@@ -2825,6 +2826,13 @@ smallest_raft_index(#?STATE{messages = Messages,
28252826
SmallestRaIdx = rabbit_fifo_index:smallest(Indexes),
28262827
min(min(SmallestDlxRaIdx, SmallestMsgsRaIdx), SmallestRaIdx).
28272828

2829+
smallest_raft_index_overview(#?STATE{messages = Messages,
2830+
ra_indexes = Indexes,
2831+
dlx = DlxState}) ->
2832+
#{message => rabbit_fifo_q:get_lowest_index(Messages),
2833+
checked_out => rabbit_fifo_index:smallest(Indexes),
2834+
dlx => rabbit_fifo_dlx:smallest_raft_index(DlxState)}.
2835+
28282836
make_requeue(ConsumerKey, Notify, [{MsgId, Idx, Header, Msg}], Acc) ->
28292837
lists:reverse([{append,
28302838
#requeue{consumer_key = ConsumerKey,

0 commit comments

Comments
 (0)