[HUDI-3147] Add endpoint_url to dynamodb lock provider (#4500)
Co-authored-by: Nicolas Paris <nicolas.paris@adevinta.com>
This commit is contained in:
@@ -156,7 +156,9 @@ public class DynamoDBBasedLockProvider implements LockProvider<LockItem> {
|
|||||||
|
|
||||||
private AmazonDynamoDB getDynamoDBClient() {
|
private AmazonDynamoDB getDynamoDBClient() {
|
||||||
String region = this.lockConfiguration.getConfig().getString(DynamoDbBasedLockConfig.DYNAMODB_LOCK_REGION.key());
|
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 =
|
AwsClientBuilder.EndpointConfiguration dynamodbEndpoint =
|
||||||
new AwsClientBuilder.EndpointConfiguration(endpointURL, region);
|
new AwsClientBuilder.EndpointConfiguration(endpointURL, region);
|
||||||
return AmazonDynamoDBClientBuilder.standard()
|
return AmazonDynamoDBClientBuilder.standard()
|
||||||
|
|||||||
@@ -100,4 +100,11 @@ public class DynamoDbBasedLockConfig extends HoodieConfig {
|
|||||||
.defaultValue(String.valueOf(10 * 60 * 1000))
|
.defaultValue(String.valueOf(10 * 60 * 1000))
|
||||||
.sinceVersion("0.10.0")
|
.sinceVersion("0.10.0")
|
||||||
.withDocumentation("For DynamoDB based lock provider, the maximum number of milliseconds to wait for creating DynamoDB table");
|
.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.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user