Skip to content
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

Force lz4 to disable Kafka-unsupported block linking when encoding #1476

Merged
merged 2 commits into from
Apr 19, 2018

Conversation

mnito
Copy link
Contributor

@mnito mnito commented Apr 18, 2018

Kafka does not support LZ4 compression with dependent blocks

https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/KafkaLZ4BlockOutputStream.java#L343

This issue was first noticed when encoding larger-than-usual messages in our application.

This change appears to solve the problem by enforcing compression with independent blocks in the underlying LZ4 package.

@dpkp
Copy link
Owner

dpkp commented Apr 18, 2018

It looks like block_linked was added as a kwarg in Dec 2017 (v0.12.0). That means that anyone using an earlier release of python-lz4 will get a TypeError (TypeError: 'block_linked' is an invalid keyword argument for this function). In earlier versions the options was block_mode=1How about adding a try / except and falling back toblock_mode=1` on a TypeError?

@mnito
Copy link
Contributor Author

mnito commented Apr 18, 2018

You got it. Thanks for the heads up.

@dpkp dpkp merged commit afc6346 into dpkp:master Apr 19, 2018
@dpkp
Copy link
Owner

dpkp commented Apr 19, 2018

Thanks!

88manpreet pushed a commit to Yelp/kafka-python that referenced this pull request Aug 1, 2018
88manpreet pushed a commit to Yelp/kafka-python that referenced this pull request Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants