dockerfile: install libzstd-dev for kafka zstd compression (4.2 backport) #12004
dockerfile: install libzstd-dev for kafka zstd compression (4.2 backport) #12004dbottini2 wants to merge 2 commits into
Conversation
The container builder stages did not install libzstd-dev, so librdkafka's find_package(ZSTD) failed and WITH_ZSTD was disabled. Kafka producers in the resulting images could not use zstd compression. Add libzstd-dev to the builder and debug builder stages so librdkafka is compiled with zstd support. Signed-off-by: Domenic Bottini <dbottini@atlassian.com>
Add a runtime test that sets compression.codec=zstd on a librdkafka conf. rd_kafka_conf_set only accepts the zstd codec when librdkafka was built with WITH_ZSTD, so this guards against images shipping without zstd support. Signed-off-by: Domenic Bottini <dbottini@atlassian.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cbca3a9072
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| res = rd_kafka_conf_set(conf, "compression.codec", "zstd", | ||
| errstr, sizeof(errstr)); | ||
| TEST_CHECK(res == RD_KAFKA_CONF_OK); |
There was a problem hiding this comment.
Guard zstd-only Kafka runtime test
In runtime-test builds where FLB_OUT_KAFKA is enabled but librdkafka was configured without WITH_ZSTD (for example, non-Docker source builds without a system libzstd-dev, or builds that explicitly disable zstd), this assertion now fails even though the Kafka output can still build and run with other codecs. The Dockerfile change only fixes the container builder stages, while cmake/kafka.cmake does not force librdkafka to use Fluent Bit's bundled zstd, so this generic runtime test makes supported Kafka test configurations fail unless zstd happens to be available.
Useful? React with 👍 / 👎.
Backport of #12003 to the 4.2 branch.
Container images were built without
libzstd-devin the builder stage, solibrdkafka's
find_package(ZSTD)failed andWITH_ZSTDwas disabled. Kafkaproducers in the shipped images could not use zstd compression.
Changes:
dockerfiles/Dockerfile: addlibzstd-devto the builder and debug builderstages so librdkafka is compiled with zstd support.
tests/runtime/out_kafka.c: add a runtime test asserting librdkafka acceptscompression.codec=zstd(only true whenWITH_ZSTDis compiled in).Addresses #11366 (Packaging: Enable ZSTD compression by default).
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
local-build-all.shbuilds the native distro packages underpackaging/distros/. This PR only changes the container images (dockerfiles/Dockerfile), which that script does not build. The container image build was verified instead (see test evidence above).ok-package-testlabel to test for all targets (requires maintainer to do).Test evidence (4.2 branch)
Example config (
rdkafka.compression.codec=zstd):Container build (
dockerfiles/Dockerfile) — zstd is now detected so librdkafkais built with
WITH_ZSTD:Runtime test (
tests/runtime/out_kafka.c::zstd_compression_available):(On master the same test was additionally run under Valgrind with no leaks and 0 errors.)
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.