[ 
https://issues.apache.org/jira/browse/KAFKA-1644?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14156149#comment-14156149
 ] 

Anton Karamanov commented on KAFKA-1644:
----------------------------------------

Jun, no {{FetchResponseSend}} still uses sendfile logic. 
{{FetchResponse.writeTo()}} only writes a fixed sized fetch message header to 
buffer.

{code}
-  buffer.putInt(size)
-  buffer.putInt(fetchResponse.correlationId)
-  buffer.putInt(fetchResponse.dataGroupedByTopic.size) // topic count
+  fetchResponse.writeTo(buffer)
{code}

Guozhang, indeed it is not, it's priority can be lowered if necessary. But it's 
a pretty simple change too.
The problem you are describing with {{FetchResponse.writeTo}} not being 
semantically consistent with that of other API messages is the very same I've 
mentioned as my concern. However, it seems like an OK compromise to me to use 
it for writing fixed-size message header, which depends only on 
{{FetchResponse}} members ({{correlationId}} and size of 
{{dataGroupedByTopic}}) instead of making it to do nothing at all just to 
conform to required function signature.

My primary goal for this task is to make {{FetchResponse}} to be a part of 
common superclass to simplify client-side message flow control. Maybe another 
trait can be introduced without any abstract members, just to mark all Kafka 
API messages. Or {{RequestOrResponse}} can be split into {{RequestOrResponse}} 
without {{writeTo}} abstract method and something like {{Writable}} trait which 
will require to provide it.


> Inherit FetchResponse from RequestOrResponse
> --------------------------------------------
>
>                 Key: KAFKA-1644
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1644
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Anton Karamanov
>            Assignee: Anton Karamanov
>         Attachments: 
> 0001-KAFKA-1644-Inherit-FetchResponse-from-RequestOrRespo.patch
>
>
> Unlike all other Kafka API responses {{FetchResponse}} is not a subclass of 
> RequestOrResponse, which requires handling it as a special case while 
> processing responses.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to