chia7712 commented on pull request #9818:
URL: https://github.com/apache/kafka/pull/9818#issuecomment-753729083


   @ijuma Thanks for your quick response!
   
   > Have you checked that we get the same batching this way?
   
   There is a test to verify the batch order 
(https://github.com/apache/kafka/blob/trunk/core/src/test/scala/unit/kafka/server/FetchRequestTest.scala#L83).
   
   >  The behavior won't be the same unless the iterator order is correct.
   
   There are two rules of batching partition data.
   
   1. the order must be kept. the tp order from input (iterator) must be equal 
to tp order in ```FetchResponseData```.
   2. batch the partitions only if we can keep the their order in 
```FetchResponseData```. For example: we should group t0-p0, t0-p1 and t1-p2 to 
two ```FetchableTopicResponse```s since the t0-p0 and t0-p1 can be merged. By 
contrast, t0-p0, t1-p1 and t0-p2 ought to generate three 
```FetchableTopicResponse```s.
   
   It seems to me the reason of generating the intermediate collections before 
is that reusing the data in ```Struct/Schema``` is not convenient.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to