You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/08/31 14:36:00 UTC

[jira] [Work logged] (BEAM-10673) DynamoDBIO.RetryConfiguration in AWS v2 is not correctly exposed

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

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

                Author: ASF GitHub Bot
            Created on: 31/Aug/20 14:35
            Start Date: 31/Aug/20 14:35
    Worklog Time Spent: 10m 
      Work Description: iemejia commented on a change in pull request #12658:
URL: https://github.com/apache/beam/pull/12658#discussion_r480162673



##########
File path: sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/dynamodb/DynamoDBIO.java
##########
@@ -293,21 +296,32 @@ public void processElement(@Element Read<T> spec, OutputReceiver<T> out) {
 
     abstract RetryPredicate getRetryPredicate();
 
-    abstract Builder toBuilder();
+    public abstract Builder toBuilder();

Review comment:
       This does not need to be public.

##########
File path: sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/dynamodb/DynamoDBIO.java
##########
@@ -111,7 +111,10 @@
  *                       //Transforming your T data into KV<String, WriteRequest>
  *                       t -> KV.of(tableName, writeRequest))
  *               .withRetryConfiguration(
- *                    DynamoDBIO.RetryConfiguration.create(5, Duration.standardMinutes(1)))
+ *                     DynamoDBIO.RetryConfiguration.builder()

Review comment:
       :+1: 

##########
File path: sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/dynamodb/DynamoDBIO.java
##########
@@ -293,21 +296,32 @@ public void processElement(@Element Read<T> spec, OutputReceiver<T> out) {
 
     abstract RetryPredicate getRetryPredicate();
 
-    abstract Builder toBuilder();
+    public abstract Builder toBuilder();
 
     public static Builder builder() {
-      return new AutoValue_DynamoDBIO_RetryConfiguration.Builder();
+      return new AutoValue_DynamoDBIO_RetryConfiguration.Builder()
+          .setRetryPredicate(DEFAULT_RETRY_PREDICATE);
     }
 
     @AutoValue.Builder
     abstract static class Builder {

Review comment:
       This class should be public so it can be used.




----------------------------------------------------------------
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:
users@infra.apache.org


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

    Worklog Id:     (was: 476599)
    Time Spent: 0.5h  (was: 20m)

> DynamoDBIO.RetryConfiguration in AWS v2 is not correctly exposed
> ----------------------------------------------------------------
>
>                 Key: BEAM-10673
>                 URL: https://issues.apache.org/jira/browse/BEAM-10673
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-aws
>    Affects Versions: 2.23.0
>            Reporter: Dennis Yung
>            Assignee: Dennis Yung
>            Priority: P2
>             Fix For: 2.25.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> As described in the documentation, DynamoDBIO is initiated with a RetryConfiguration through withRetryConfiguration()
> {code:java}
>  PCollection<T> data = ...;
>  data.apply(
>            DynamoDBIO.<WriteRequest>write()
>                .withWriteRequestMapperFn(
>                    (SerializableFunction<T, KV<String, WriteRequest>>)
>                        //Transforming your T data into KV<String, WriteRequest>
>                        t -> KV.of(tableName, writeRequest))
>                .withRetryConfiguration(
>                     DynamoDBIO.RetryConfiguration.create(5, Duration.standardMinutes(1)))
>                .withAwsClientsProvider(new BasicDynamoDbProvider(accessKey, secretKey, region));
> {code}
> It works on beam-sdks-java-io-amazon-web-services (aws sdk version 1), but not on beam-sdks-java-io-amazon-web-services2 (aws sdk version 2).
> It is because io.aws2.dynamodb.DynamoDBIO.RetryConfiguration adopted a AutoValue builder design in place of the create method. However, the builder do not have public methods for setting values and building a RetryConfiguration. Moreover, validation was not implemented
> {code:java}
>   @AutoValue
>   public abstract static class RetryConfiguration implements Serializable {
>     
>    /.../
>     public static Builder builder() {
>       return new AutoValue_DynamoDBIO_RetryConfiguration.Builder();
>     }
>     @AutoValue.Builder
>     abstract static class Builder {
>       abstract Builder setMaxAttempts(int maxAttempts);
>       abstract Builder setMaxDuration(Duration maxDuration);
>       abstract Builder setRetryPredicate(RetryPredicate retryPredicate);
>       abstract RetryConfiguration build();
>     }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)