Skip to content

Commit

Permalink
Apply the AlternatorEndpointProvider only on custom endpoints
Browse files Browse the repository at this point in the history
The previous implementation was failing when used on AWS DynamoDB because `conf.get(DynamoDBConstants.ENDPOINT)` was `null`.

This was not caught by our tests because our tests always use a custom endpoint (see scylladb#113)
  • Loading branch information
julienrf committed Aug 23, 2024
1 parent b9be9fb commit 6b0d047
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions migrator/src/main/scala/com/scylladb/migrator/DynamoUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,14 @@ object DynamoUtils {
class AlternatorLoadBalancingEnabler extends DynamoDbClientBuilderTransformer with Configurable {
private var conf: Configuration = null

override def apply(builder: DynamoDbClientBuilder): DynamoDbClientBuilder =
builder.endpointProvider(
new AlternatorEndpointProvider(URI.create(conf.get(DynamoDBConstants.ENDPOINT)))
)
override def apply(builder: DynamoDbClientBuilder): DynamoDbClientBuilder = {
for (customEndpoint <- Option(conf.get(DynamoDBConstants.ENDPOINT))) {
builder.endpointProvider(
new AlternatorEndpointProvider(URI.create(customEndpoint))
)
}
builder
}

override def setConf(configuration: Configuration): Unit =
conf = configuration
Expand Down

0 comments on commit 6b0d047

Please sign in to comment.