CCCLL opened a new pull request, #23813:
URL: https://github.com/apache/kafka/pull/23813
`kafka-console-producer.sh` always sets `compression.type` from its
`--compression-codec` option, which falls back to `none` when the
option is not given. A `compression.type` set with `--command-property`
or in the `--command-config` file (or with the deprecated
`--producer-property` and `--producer.config`) is therefore silently
replaced and the records are sent uncompressed. For example,
`kafka-dump-log.sh` shows `compresscodec: none` for the records
produced by
kafka-console-producer.sh --bootstrap-server localhost:9092 \
--topic test --command-property compression.type=zstd
KAFKA-6627 fixed the same problem for the other producer options of
the tool, which go through `CommandLineUtils.maybeMergeOptions`, but
`--compression-codec` was left out. It does not fit that helper as is,
because the option means `gzip` when it is given without a value.
Apply the same precedence here: `--compression-codec` wins when it is
given, otherwise a configured `compression.type` is kept, and `none`
is used only when neither is set.
The new tests cover the default, both ways of configuring the
compression type and the precedence of `--compression-codec`. The
tests for `--command-property` and `--command-config` fail without the
fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]