Question about dh6: Fetch with no topics

Hi,
I understand that we don’t have to parse the Fetch request body but I was wondering how it can work with several partitions per topic as I don’t see a Partition Array length in the request definition:
" topics => topic_id [partitions] TAG_BUFFER
topic_id => UUID
partitions => partition current_leader_epoch fetch_offset last_fetched_epoch log_start_offset partition_max_bytes TAG_BUFFER
partition => INT32
current_leader_epoch => INT32
fetch_offset => INT64
last_fetched_epoch => INT32
log_start_offset => INT64
partition_max_bytes => INT32
forgotten_topics_data => topic_id [partitions] TAG_BUFFER "

How can one know that after partition_max_bytes, there is a topic_id referring to forgotten_topics_data or another partition index ?
Thanks

Hi @Gad, thanks for your question! The Kafka docs can be unclear and confusing.

In this case, [partitions] is a COMPACT_ARRAY, meaning a length field will be included in the request—even though the definition doesn’t explicitly state it.

Let me know if you’d like further clarification!

1 Like

Thank you Andy, makes sense !
Is it the square brackets around partitions that indicate the COMPACT_ARRAY ?

Yep, [partitions] indicates an array, and in newer versions of Kafka APIs, you can assume it’s a COMPACT_ARRAY rather than a standard ARRAY.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.