Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new configuration option to limit the maximum size of a record before compression in the Kafka producer. The changes ensure that the producer can handle highly compressible data more efficiently by setting a cap on the uncompressed record size. The most important changes include adding a new configuration parameter, updating the producer class to use this parameter, and modifying the error handling to reflect the new limit.
New Configuration Parameter:
clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java
: AddedMAX_RECORD_SIZE_CONFIG
to define the maximum size of a record before compression, with a default value and documentation. [1] [2]Updates to Producer Class:
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
: IntroducedmaxRecordSize
field and updated constructors to initialize it using the new configuration parameter. [1] [2] [3]Error Handling:
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
: ModifiedensureValidRecordSize
method to usemaxRecordSize
instead ofmaxRequestSize
for validation and error messages.Configuration File:
config/producer.properties
: Added commented-out entry formax.record.size
to the producer properties file for user reference.