-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
KAFKA-7632: Allow fine-grained configuration for compression #5927
Conversation
Please note that this is a draft implementation. It will be updated following the update of zstd-jni by @luben. (see: luben/zstd-jni#80) |
clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java
Outdated
Show resolved
Hide resolved
I just shipped zstd-jni-1.3.7-2 that adds methods to query min/max supported compression levels. |
I just applied zstd-jni-1.3.7-2. Thanks again @luben!! |
And there is another issue here; as of now, Kafka's checkstyle rule disallows more than 13 parameters for any method. However, with introducing a new configuration entity, the constructor of |
b8e939c
to
2d3b64a
Compare
3cdd7e1
to
245b37e
Compare
a7be368
to
8427a03
Compare
8427a03
to
c5fdab9
Compare
…ampType, long, long, long, short, int, boolean, boolean, int, int): test-only method.
…so can support more than 13 parameters.
…tampType, long, long)
…tampType, long, long, int)
… short, int, boolean)
…tampType, long, long, long, short, int)
…tampType, long, long, long, short, int, boolean, int)
…tampType, long, long, long, short, int, boolean, boolean, int)
…ds#builder, instead of instantiating MemoryRecordsBuilder directly
…ead of instantiating MemoryRecordsBuilder directly
…okerCompressionCodec#getTargetCompressionCodec(String, CompressionCodec)
…Codec#getTargetCompressionType. (returns CompressionType) 1. LogAppendInfo, LogValidator now uses CompressionType instead of CompressionCodec. 2. All related tests (BrokerCompressionTest, LogValidatorTest, AbstractFetcherThreadTest) are updated accordingly.
…pression level, block size configuration for lz4. 1. Make KafkaLZ4BlockOutputStream#BLOCKSIZE_[64KB,256KB,1MB,4MB] private. 2. Add KafkaLZ4BlockOutputStream#AVAILABLE_BLOCKSIZES. 3. Remove KafkaLZ4BlockOutputStream(OutputStream, int, boolean), KafkaLZ4BlockOutputStream(OutputStream, int), KafkaLZ4BlockOutputStream(OutputStream): not used. 4. Remove blockChecksum from KafkaLZ4BlockOutputStream(OutputStream, int, boolean, boolean): it is always false. FLG instance is now instantiated with FLG(), which is equivalent to FLG(false). To support block size and compression level, it now receives LZ4Compressor and BD instance as a parameter. Now, KafkaLZ4BlockOutputStream#of creates LZ4Compressor, BD instance with useBrokenFlagDescriptorChecksum parameter as per compression level, block size, and magic. CompressionType.LZ4#wrapForOutput now calls KafkaLZ4BlockOutputStream#of instead of KafkaLZ4BlockOutputStream(OutputStream, boolean); KafkaLZ4BlockOutputStream(OutputStream, boolean) is also removed for it is not used anymore. 5. KafkaLZ4Test: add magic, compressionLevel, blockSize as testing parameters. useBrokenFlagDescriptorChecksum is now determined by magic. blockChecksum is removed.
1. Add CompressionConfig: without this class, the constructor of MemoryRecordsBuilder violates parameter count limit. (it aready has 13 parameters.) 2. MemoryRecordsBuilder now uses CompressionConfig instead of CompressionType. 3. Add level, blockSize parameters to CompressionType#wrapForOutput. 4. Add compressionLevel, compressionBufferSize, compressionConfig to MemoryRecords.Builder.
1. Make LogValidator#validateMessagesAndAssignOffsets to use CompressionType and CompressionConfig; not CompressionCodec.
c5fdab9
to
d116b47
Compare
Here is the re-implementation of KIP-390, rebased against the latest trunk. The commits as of present consist like the following:
Since the public interface is not settled yet, this PR currently includes the common commits by step 2. For the final ones, please refer the following branches: |
Closes this PR in preference of a new one. |
This PR implements KIP-390: Add producer option to adjust compression level.
Committer Checklist (excluded from commit message)