mansipp commented on code in PR #9347:
URL: https://github.com/apache/hudi/pull/9347#discussion_r1283877492
##########
hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedLockProvider.java:
##########
@@ -153,45 +153,53 @@ public LockItem getLock() {
return lock;
}
- private AmazonDynamoDB getDynamoDBClient() {
+ private DynamoDbClient getDynamoDBClient() {
String region =
this.dynamoDBLockConfiguration.getString(DynamoDbBasedLockConfig.DYNAMODB_LOCK_REGION);
String endpointURL =
this.dynamoDBLockConfiguration.contains(DynamoDbBasedLockConfig.DYNAMODB_ENDPOINT_URL.key())
- ?
this.dynamoDBLockConfiguration.getString(DynamoDbBasedLockConfig.DYNAMODB_ENDPOINT_URL)
- :
RegionUtils.getRegion(region).getServiceEndpoint(AmazonDynamoDB.ENDPOINT_PREFIX);
- AwsClientBuilder.EndpointConfiguration dynamodbEndpoint =
- new AwsClientBuilder.EndpointConfiguration(endpointURL, region);
- return AmazonDynamoDBClientBuilder.standard()
- .withEndpointConfiguration(dynamodbEndpoint)
-
.withCredentials(HoodieAWSCredentialsProviderFactory.getAwsCredentialsProvider(dynamoDBLockConfiguration.getProps()))
+ ?
this.dynamoDBLockConfiguration.getString(DynamoDbBasedLockConfig.DYNAMODB_ENDPOINT_URL)
+ :
DynamoDbClient.serviceMetadata().endpointFor(Region.of(region)).toString();
+
+ if (!endpointURL.startsWith("https://") ||
!endpointURL.startsWith("http://")) {
Review Comment:
We are getting this error if we don't specify http:// or https:// in sdk v2.
Based on this doc dynamodb supports both http and https so added a check for
both. https://docs.aws.amazon.com/general/latest/gr/ddb.html
```
Caused by: java.lang.NullPointerException: The URI scheme of
endpointOverride must not be null.
at
org.apache.hudi.software.amazon.awssdk.utils.Validate.paramNotNull(Validate.java:156)
at
org.apache.hudi.software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.endpointOverride(SdkDefaultClientBuilder.java:445)
at
org.apache.hudi.aws.transaction.lock.DynamoDBBasedLockProvider.getDynamoDBClient(DynamoDBBasedLockProvider.java:163)
at
org.apache.hudi.aws.transaction.lock.DynamoDBBasedLockProvider.<init>(DynamoDBBasedLockProvider.java:87)
at
org.apache.hudi.aws.transaction.lock.DynamoDBBasedLockProvider.<init>(DynamoDBBasedLockProvider.java:77)
... 65 more
```
--
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]