This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 02b2fa0e3c6 KAFKA-17926 Improve the documentation explaining why 
max.in.flight.requests.per.connection should not exceed 5 (#17719)
02b2fa0e3c6 is described below

commit 02b2fa0e3c6e52ba01a88dc4a949a85cb87177ec
Author: PoAn Yang <[email protected]>
AuthorDate: Fri Nov 8 23:42:52 2024 +0800

    KAFKA-17926 Improve the documentation explaining why 
max.in.flight.requests.per.connection should not exceed 5 (#17719)
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 .../main/java/org/apache/kafka/clients/producer/ProducerConfig.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java 
b/clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java
index 5d57da8fd8d..8b360d4d839 100644
--- 
a/clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java
+++ 
b/clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java
@@ -255,6 +255,7 @@ public class ProducerConfig extends AbstractConfig {
     public static final String METRIC_REPORTER_CLASSES_CONFIG = 
CommonClientConfigs.METRIC_REPORTER_CLASSES_CONFIG;
 
     // max.in.flight.requests.per.connection should be less than or equal to 5 
when idempotence producer enabled to ensure message ordering
+    // The value 5 is aligned with ProducerStateEntry#NUM_BATCHES_TO_RETAIN.
     private static final int 
MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION_FOR_IDEMPOTENCE = 5;
 
     /** <code>max.in.flight.requests.per.connection</code> */
@@ -263,8 +264,8 @@ public class ProducerConfig extends AbstractConfig {
                                                                             + 
" Note that if this configuration is set to be greater than 1 and 
<code>enable.idempotence</code> is set to false, there is a risk of"
                                                                             + 
" message reordering after a failed send due to retries (i.e., if retries are 
enabled); "
                                                                             + 
" if retries are disabled or if <code>enable.idempotence</code> is set to true, 
ordering will be preserved."
-                                                                            + 
" Additionally, enabling idempotence requires the value of this configuration 
to be less than or equal to " + 
MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION_FOR_IDEMPOTENCE + "."
-                                                                            + 
" If conflicting configurations are set and idempotence is not explicitly 
enabled, idempotence is disabled. ";
+                                                                            + 
" Additionally, enabling idempotence requires the value of this configuration 
to be less than or equal to " + 
MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION_FOR_IDEMPOTENCE + ","
+                                                                            + 
" because broker only retains at most 5 batches for each producer. If the value 
is more than 5, previous batches may be removed on broker side.";
 
     /** <code>retries</code> */
     public static final String RETRIES_CONFIG = 
CommonClientConfigs.RETRIES_CONFIG;

Reply via email to