[ 
https://issues.apache.org/jira/browse/BEAM-3026?focusedWorklogId=135655&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-135655
 ]

ASF GitHub Bot logged work on BEAM-3026:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Aug/18 11:05
            Start Date: 17/Aug/18 11:05
    Worklog Time Spent: 10m 
      Work Description: echauchot commented on a change in pull request #6146: 
[BEAM-3026] Adding retrying behavior on ElasticSearchIO
URL: https://github.com/apache/beam/pull/6146#discussion_r210640533
 
 

 ##########
 File path: 
sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java
 ##########
 @@ -220,56 +221,33 @@ private HttpClient createHttpClient() {
    *       </ul>
    * </ul>
    */
-  @AutoValue
-  public abstract static class RetryConfiguration implements Serializable {
-    @VisibleForTesting
-    static final RetryPredicate DEFAULT_RETRY_PREDICATE = new 
DefaultRetryPredicate();
-
-    abstract int getMaxAttempts();
-
-    abstract Duration getMaxDuration();
+  public static class RetryConfiguration extends BaseRetryConfiguration {
 
-    abstract RetryPredicate getRetryPredicate();
-
-    abstract Builder builder();
-
-    @AutoValue.Builder
-    abstract static class Builder {
-      abstract SolrIO.RetryConfiguration.Builder setMaxAttempts(int 
maxAttempts);
-
-      abstract SolrIO.RetryConfiguration.Builder setMaxDuration(Duration 
maxDuration);
-
-      abstract SolrIO.RetryConfiguration.Builder 
setRetryPredicate(RetryPredicate retryPredicate);
-
-      abstract SolrIO.RetryConfiguration build();
+    private RetryConfiguration(
+        int maxAttempts, Duration maxDuration, RetryPredicate 
defaultRetryPredicate) {
+      super(maxAttempts, maxDuration, defaultRetryPredicate);
     }
 
+    /**
+     * Creates RetryConfiguration for {@link SolrIO} with provided 
maxAttempts, maxDurations and
+     * exponential backoff based retries.
+     */
     public static RetryConfiguration create(int maxAttempts, Duration 
maxDuration) {
       checkArgument(maxAttempts > 0, "maxAttempts must be greater than 0");
       checkArgument(
           maxDuration != null && maxDuration.isLongerThan(Duration.ZERO),
           "maxDuration must be greater than 0");
-      return new AutoValue_SolrIO_RetryConfiguration.Builder()
-          .setMaxAttempts(maxAttempts)
-          .setMaxDuration(maxDuration)
-          .setRetryPredicate(DEFAULT_RETRY_PREDICATE)
-          .build();
+      return new RetryConfiguration(maxAttempts, maxDuration, 
DEFAULT_RETRY_PREDICATE);
     }
 
-    // Exposed only to allow tests to easily simulate server errors
     @VisibleForTesting
     RetryConfiguration withRetryPredicate(RetryPredicate predicate) {
 
 Review comment:
   As you are using with* builder pattern in `BaseRetryConfiguration` 
subclasses, I would prefer that you use autovalue to conform to beam pattern.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 135655)
    Time Spent: 7h 20m  (was: 7h 10m)

> Improve retrying in ElasticSearch client
> ----------------------------------------
>
>                 Key: BEAM-3026
>                 URL: https://issues.apache.org/jira/browse/BEAM-3026
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-elasticsearch
>            Reporter: Tim Robertson
>            Assignee: Ravi Pathak
>            Priority: Major
>             Fix For: 2.7.0
>
>          Time Spent: 7h 20m
>  Remaining Estimate: 0h
>
> Currently an overloaded ES server will result in clients failing fast.
> I suggest implementing backoff pauses.  Perhaps something like this:
> {code}
>     ElasticsearchIO.ConnectionConfiguration conn = 
> ElasticsearchIO.ConnectionConfiguration
>       .create(new String[]{"http://...:9200"}, "test", "test")
>       .retryWithWaitStrategy(WaitStrategies.exponentialBackoff(1000, 
> TimeUnit.MILLISECONDS)
>       .retryWithStopStrategy(StopStrategies.stopAfterAttempt(10)
>     );
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to