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

Lee Dongjin commented on KAFKA-7549:
------------------------------------

[~ijuma] I reviewed the problem. Here is the result:

The KIP documentation states what broker returns for invalid Produce request 
(i.e., ZSTD compressed message with a Produce API version below 7), but not 
what happens when the user tries to instantiate an invalid ProducerRequest 
instance. Validation on ProducerRequest instantiation was [proposed and 
added|https://github.com/apache/kafka/pull/2267#discussion_r222913248] after 
the KIP was accepted and the revision was under progress. It is why it is not 
in the KIP document - Sorry, I was updating the KIP following the discussion on 
PR but not completed yet.

Here, we have three choices:

1. Throw InvalidRecordException (current): It follows the consistency with 
other exceptions in ProduceRequest#validateRecords.
 2. Throw UnsupportedVersionException: [What Jason proposed at 
first|https://github.com/apache/kafka/pull/2267#pullrequestreview-162177303], 
but breaks consistency.
 3. Throw UnsupportedCompressionType: It follows what broker returns, but 
breaks consistency also.

Which approach do you prefer?

> Old ProduceRequest with zstd compression does not return error to client
> ------------------------------------------------------------------------
>
>                 Key: KAFKA-7549
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7549
>             Project: Kafka
>          Issue Type: Bug
>          Components: compression
>            Reporter: Magnus Edenhill
>            Assignee: Lee Dongjin
>            Priority: Major
>             Fix For: 2.1.0
>
>
> Kafka broker v2.1.0rc0.
>  
> KIP-110 states that:
> "Zstd will only be allowed for the bumped produce API. That is, for older 
> version clients(=below KAFKA_2_1_IV0), we return UNSUPPORTED_COMPRESSION_TYPE 
> regardless of the message format."
>  
> However, sending a ProduceRequest V3 with zstd compression (which is a client 
> side bug) closes the connection with the following exception rather than 
> returning UNSUPPORTED_COMPRESSION_TYPE in the ProduceResponse:
>  
> {noformat}
> [2018-10-25 11:40:31,813] ERROR Exception while processing request from 
> 127.0.0.1:60723-127.0.0.1:60656-94 (kafka.network.Processor)
> org.apache.kafka.common.errors.InvalidRequestException: Error getting request 
> for apiKey: PRODUCE, apiVersion: 3, connectionId: 
> 127.0.0.1:60723-127.0.0.1:60656-94, listenerName: ListenerName(PLAINTEXT), 
> principal: User:ANONYMOUS
> Caused by: org.apache.kafka.common.record.InvalidRecordException: Produce 
> requests with version 3 are note allowed to use ZStandard compression
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to