-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending messages with ZStd compression enabled fails in multiple ways #1252
Comments
I am also getting 'InvalidRecordException: Produce requests with version 3 are note allowed to use ZStandard compression' |
@bobrik you fixed something related to zstd earlier, any idea? |
I added support for zstd before Kafka added it. In further discussions Kafka developers apparently decided to bump protocol version to allow zstd compression. See logic in this file: I think Sarama needs to mimic the same behavior, probably somewhere here I guess: |
Ah, thanks a lot. I will get the PR soon. |
I would love to get this fixed. (Apparently the PR itself isn't good enough yet?) |
Correct, the PR doesn't appear to actually send Producer Protocol Version I'm frustrated that Zstd support wound up getting advertised in |
Yeah, there's a number of breaking protocol changes that I see in terms of adding new expected fields to the request/response, so I don't think I should be the one to do this. I have no idea how Cloudflare made this work (unless they hacked their Kafka broker to not demand a minimum protocol version to use zstd), so... gurp. |
Switch from cgo package to pure Go implementation. This will (when fixed) work even if no cgo is present. https://github.com/klauspost/compress/tree/master/zstd#zstd Compression level is removed. It could be made so the first request determines the compression level. But since there is currently only two levels (fast and default) I am not sure it is worth it. This does NOT fix IBM#1252 - only updates the code used for compression/decompression.
Could someone reopen this issue? |
Hey @akrennmair Could you please double check that it works for you? Thanks |
closed by #1574 |
Fix confirmed working. Thank you!!! |
Versions
Sarama Version: v1.20.1
Kafka Version: 2.1.0 (Scala version 2.12)
Go Version: 1.11.4
Configuration
What configuration values are you using for Sarama and Kafka?
Kafka configuration:
server.properties.txt
Logs
Problem Description
I created a minimal test case to reproduce the issue:
The test program attempts to send a single message to Kafka using a
sarama.AsyncProducer
with ZStd compression enabled. It does so twice in a row, with different Kafka versions.With version
sarama.V0_10_2_0
, it fails with the error outputTEST: sending message failed: kafka server: Message contents does not match its CRC.
, whereas with versionsarama.V2_1_0_0
, it fails with the error messageTEST: sending message failed: EOF
. In the latter case, Kafka also produces an error log output:The expected behaviour for the first case is that sending the message works without causing an error.
The expected behaviour for the second case is that
cfg.Validate
indicates the invalid combination of Kafka version and compression codec.The text was updated successfully, but these errors were encountered: