awslabs / amazon-kinesis-client

Client library for Amazon Kinesis
Apache License 2.0
632 stars 461 forks source link

DynamoDbException ReadCapacityUnits and WriteCapacityUnits must both be specified when BillingMode is PROVISIONED #1357

Open vsadokhin opened 6 days ago

vsadokhin commented 6 days ago

Hello!

We try to configure the client to create DynamoDB table with PROVISIONED billing mode like this:

LeaseManagementConfig leaseManagementConfig = configsBuilder.leaseManagementConfig();
leaseManagementConfig.billingMode(BillingMode.PROVISIONED);
leaseManagementConfig.initialLeaseTableReadCapacity(5);
leaseManagementConfig.initialLeaseTableWriteCapacity(10);
leaseManagementConfig.initialPositionInStream(InitialPositionInStream.LATEST);
leaseManagementConfig.streamName("someStreamName");

but it fails to create a table:

software.amazon.kinesis.leases.exceptions.DependencyException: software.amazon.awssdk.services.dynamodb.model.DynamoDbException: One or more parameter values were invalid: ReadCapacityUnits and WriteCapacityUnits must both be specified when BillingMode is PROVISIONED (Service: DynamoDb, Status Code: 400, Request ID: <SOME_ID>)
    at software.amazon.kinesis.leases.dynamodb.DynamoDBLeaseRefresher.createTableIfNotExists(DynamoDBLeaseRefresher.java:247)
    at software.amazon.kinesis.leases.dynamodb.DynamoDBLeaseRefresher.createLeaseTableIfNotExists(DynamoDBLeaseRefresher.java:212)
    at software.amazon.kinesis.leases.dynamodb.DynamoDBLeaseCoordinator.initialize(DynamoDBLeaseCoordinator.java:260)
    at software.amazon.kinesis.coordinator.Scheduler.initialize(Scheduler.java:356)
    at software.amazon.kinesis.coordinator.Scheduler.run(Scheduler.java:330)

Looking at source code it seems that createLeaseTableIfNotExists() method does not respect initialLeaseTableReadCapacity and initialLeaseTableWriteCapacity provided nor specify readCapacityUnits / writeCapacityUnits based on anything else. There is also a deprecated method with signature createLeaseTableIfNotExists(@NonNull final Long readCapacity, @NonNull final Long writeCapacity) but it looks like it is not used anymore.

amazon-kinesis-client version 2.5.8

Do we configure it wrong way? Or is it a bug in the client?

Regards, Vasiliy