skaundinya15 commented on a change in pull request #8846:
URL: https://github.com/apache/kafka/pull/8846#discussion_r444631685



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java
##########
@@ -84,6 +84,9 @@
     public static final String RETRY_BACKOFF_MS_CONFIG = "retry.backoff.ms";
     public static final String RETRY_BACKOFF_MS_DOC = "The amount of time to 
wait before attempting to retry a failed request to a given topic partition. 
This avoids repeatedly sending requests in a tight loop under some failure 
scenarios.";
 
+    public static final String RETRY_BACKOFF_MAX_MS_CONFIG = 
"retry.backoff.max.ms";
+    public static final String RETRY_BACKOFF_MAX_MS_DOC = "The maximum amount 
of time in milliseconds to wait when retrying a request to the broker that has 
repeatedly failed. If provided, the backoff per client will increase 
exponentially for each failed request, up to this maximum. To prevent all 
clients from being synchronized upon retry, a randomization factor of 0.2 will 
be applied to the backoff, resulting in a random range between 20% below and 
20% above the computed value. If retry.backoff.ms is set to be higher than 
retry.backoff.max.ms, then retry.backoff.max.ms will be used as a constant 
backoff from the beginning without any exponential increase";

Review comment:
       Nit: Can we change the wording to the following?
   ```suggestion
       public static final String RETRY_BACKOFF_MAX_MS_DOC = "The maximum 
amount of time in milliseconds to wait when retrying a request to the broker 
that has repeatedly failed. If provided, the backoff per client will increase 
exponentially for each failed request, up to this maximum. To prevent all 
clients from being synchronized upon retry, a randomization jitter with a 
factor of 0.2 will be applied to the backoff, resulting in the backoff falling 
within a range between 20% below and 20% above the computed value. If 
retry.backoff.ms is set to be higher than retry.backoff.max.ms, then 
retry.backoff.max.ms will be used as a constant backoff from the beginning 
without any exponential increase";
   ```

##########
File path: 
clients/src/main/java/org/apache/kafka/common/utils/GeometricProgression.java
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.common.utils;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * An util class for exponential backoff, backoff, etc...
+ * The formula is Term(n) = random(1 - jitter, 1 + jitter) * scaleFactor * 
(ratio) ^ n
+ * If scaleFactor is greater or equal than termMax, a constant term of will be 
provided
+ * This class is thread-safe
+ */
+public class GeometricProgression {
+    private final int ratio;
+    private final double expMax;
+    private final long scaleFactor;

Review comment:
       It seems like that refactoring and renaming to `ExponentialBackoff` has 
happened in the patch #8683. Could you refactor this patch on top of that so 
it's more inline with what will be going into `trunk`?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to