From f4f0b00da6cf8daf01dea102f9442cc940661b0f Mon Sep 17 00:00:00 2001 From: Yuto Kawamura Date: Mon, 11 Jul 2016 22:47:14 +0900 Subject: [PATCH 1/3] MINOR: Doc of 'retires' config should mention about max.in.flight.requests.per.connection to avoid confusion --- .../org/apache/kafka/clients/producer/ProducerConfig.java | 4 ++-- 1 file changed, 2 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 c493f67f87613..a9f8beda4bfa5 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 @@ -164,8 +164,8 @@ public class ProducerConfig extends AbstractConfig { public static final String RETRIES_CONFIG = "retries"; private static final String RETRIES_DOC = "Setting a value greater than zero will cause the client to resend any record whose send fails with a potentially transient error." + " Note that this retry is no different than if the client resent the record upon receiving the " - + "error. Allowing retries will potentially change the ordering of records because if two records are " - + "sent to a single partition, and the first fails and is retried but the second succeeds, then the second record " + + "error. Allowing retries without setting max.in.flight.requests.per.connection to 1 will potentially change the ordering of records because if two batches are " + + "sent to a single partition, and the first fails and is retried but the second succeeds, then the second batch " + "may appear first."; /** retry.backoff.ms */ From 58c68bf9ab756e61e4486b66eff97f1fc99767bf Mon Sep 17 00:00:00 2001 From: Yuto Kawamura Date: Tue, 19 Jul 2016 02:21:11 +0900 Subject: [PATCH 2/3] (fixup) much accurate expression --- .../java/org/apache/kafka/clients/producer/ProducerConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a9f8beda4bfa5..02840f2cf714b 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 @@ -165,7 +165,7 @@ public class ProducerConfig extends AbstractConfig { private static final String RETRIES_DOC = "Setting a value greater than zero will cause the client to resend any record whose send fails with a potentially transient error." + " Note that this retry is no different than if the client resent the record upon receiving the " + "error. Allowing retries without setting max.in.flight.requests.per.connection to 1 will potentially change the ordering of records because if two batches are " - + "sent to a single partition, and the first fails and is retried but the second succeeds, then the second batch " + + "sent to a single partition, and the first fails and is retried but the second succeeds, then the records in the second batch " + "may appear first."; /** retry.backoff.ms */ From fefe122113890d3017af553b680f03ff7efea740 Mon Sep 17 00:00:00 2001 From: Yuto Kawamura Date: Tue, 19 Jul 2016 02:26:38 +0900 Subject: [PATCH 3/3] (fixup) use predefined constant instead of hardcoding --- .../kafka/clients/producer/ProducerConfig.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 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 02840f2cf714b..8685dbd5e1320 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 @@ -160,14 +160,6 @@ public class ProducerConfig extends AbstractConfig { + "not all memory the producer uses is used for buffering. Some additional memory will be used for compression (if " + "compression is enabled) as well as for maintaining in-flight requests."; - /** retries */ - public static final String RETRIES_CONFIG = "retries"; - private static final String RETRIES_DOC = "Setting a value greater than zero will cause the client to resend any record whose send fails with a potentially transient error." - + " Note that this retry is no different than if the client resent the record upon receiving the " - + "error. Allowing retries without setting max.in.flight.requests.per.connection to 1 will potentially change the ordering of records because if two batches are " - + "sent to a single partition, and the first fails and is retried but the second succeeds, then the records in the second batch " - + "may appear first."; - /** retry.backoff.ms */ public static final String RETRY_BACKOFF_MS_CONFIG = CommonClientConfigs.RETRY_BACKOFF_MS_CONFIG; @@ -192,6 +184,14 @@ public class ProducerConfig extends AbstractConfig { + " Note that if this setting is set to be greater than 1 and there are failed sends, there is a risk of" + " message re-ordering due to retries (i.e., if retries are enabled)."; + /** retries */ + public static final String RETRIES_CONFIG = "retries"; + private static final String RETRIES_DOC = "Setting a value greater than zero will cause the client to resend any record whose send fails with a potentially transient error." + + " Note that this retry is no different than if the client resent the record upon receiving the error." + + " Allowing retries without setting " + MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION + " to 1 will potentially change the" + + " ordering of records because if two batches are sent to a single partition, and the first fails and is retried but the second" + + " succeeds, then the records in the second batch may appear first."; + /** key.serializer */ public static final String KEY_SERIALIZER_CLASS_CONFIG = "key.serializer"; public static final String KEY_SERIALIZER_CLASS_DOC = "Serializer class for key that implements the Serializer interface.";