1
0

[HUDI-3147] Add endpoint_url to dynamodb lock provider (#4500)

Co-authored-by: Nicolas Paris <nicolas.paris@adevinta.com>
This commit is contained in:
Nicolas Paris
2022-01-04 22:42:28 +01:00
committed by GitHub
parent bf4e3d63e7
commit 37b15ff458
2 changed files with 17 additions and 8 deletions

View File

@@ -156,7 +156,9 @@ public class DynamoDBBasedLockProvider implements LockProvider<LockItem> {
private AmazonDynamoDB getDynamoDBClient() {
String region = this.lockConfiguration.getConfig().getString(DynamoDbBasedLockConfig.DYNAMODB_LOCK_REGION.key());
String endpointURL = RegionUtils.getRegion(region).getServiceEndpoint(AmazonDynamoDB.ENDPOINT_PREFIX);
String endpointURL = this.lockConfiguration.getConfig().getString(DynamoDbBasedLockConfig.DYNAMODB_ENDPOINT_URL.key()) == null
? RegionUtils.getRegion(region).getServiceEndpoint(AmazonDynamoDB.ENDPOINT_PREFIX)
: this.lockConfiguration.getConfig().getString(DynamoDbBasedLockConfig.DYNAMODB_ENDPOINT_URL.key());
AwsClientBuilder.EndpointConfiguration dynamodbEndpoint =
new AwsClientBuilder.EndpointConfiguration(endpointURL, region);
return AmazonDynamoDBClientBuilder.standard()

View File

@@ -100,4 +100,11 @@ public class DynamoDbBasedLockConfig extends HoodieConfig {
.defaultValue(String.valueOf(10 * 60 * 1000))
.sinceVersion("0.10.0")
.withDocumentation("For DynamoDB based lock provider, the maximum number of milliseconds to wait for creating DynamoDB table");
public static final ConfigProperty<String> DYNAMODB_ENDPOINT_URL = ConfigProperty
.key(DYNAMODB_BASED_LOCK_PROPERTY_PREFIX + "endpoint_url")
.defaultValue("us-east-1")
.sinceVersion("0.11.0")
.withDocumentation("For DynamoDB based lock provider, the url endpoint used for Amazon DynamoDB service."
+ " Useful for development with a local dynamodb instance.");
}