rahil-c commented on code in PR #8441: URL: https://github.com/apache/hudi/pull/8441#discussion_r1171953158
########## hudi-aws/src/main/java/org/apache/hudi/aws/utils/DynamoTableUtils.java: ########## @@ -0,0 +1,265 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file 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.hudi.aws.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import software.amazon.awssdk.core.exception.SdkClientException; +import software.amazon.awssdk.services.dynamodb.DynamoDbClient; +import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest; +import software.amazon.awssdk.services.dynamodb.model.DeleteTableRequest; +import software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest; +import software.amazon.awssdk.services.dynamodb.model.ResourceInUseException; +import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException; +import software.amazon.awssdk.services.dynamodb.model.TableDescription; +import software.amazon.awssdk.services.dynamodb.model.TableStatus; + +/** + * Reused code from https://github.com/aws/aws-sdk-java-v2/blob/master/services/dynamodb/src/test/java/utils/test/util/TableUtils.java + * + * Utility methods for working with DynamoDB tables. + * + * <pre class="brush: java"> + * // ... create DynamoDB table ... + * try { + * waitUntilActive(dynamoDB, myTableName()); + * } catch (SdkClientException e) { + * // table didn't become active + * } + * // ... start making calls to table ... + * </pre> + */ +public class DynamoTableUtils { Review Comment: Yes unfortunately this is an issue. Basically in hudi we were using the `TableUtils` class which was a src class in V1 that we would invoke in dynamodb locking feature, but now in v2 this class been moved as a test class see this commit. https://github.com/aws/aws-sdk-java-v2/commit/973237ca1713d20233cfe7e66bc21066c0f89a84. Because of this we can not access anymore this class anymore due to its test scope. I didnt see any replacement DynamoDB utility like classes in the SDK v2 So Currently im opted to resuse class over and left a comment to where this code can be found so we dont have to reinvent here. Let me know if you have any other ideas on how we can go about this. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
