awslabs / amazon-dynamodb-local-samples

This is a sample Java project that demonstrates how to use DynamoDB Local for local development and testing
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
MIT No Attribution
15 stars 9 forks source link

DynamoDBLocal throws UnsupportedOperationException on updateContinuousBackups #17

Open MarkusAJacobsen opened 5 months ago

MarkusAJacobsen commented 5 months ago

Hi,

I'm trying to set continuous backup right after creating a new table via AmazonDynamDBs method updateContinuousBackups. In my unit tests I use dynamodbv2.local.embedded.DynamoDBEmbedded and dynamodbv2.local.shared.access.AmazonDynamoDBLocal to create my test client. Then when executing the updateContinuousBackups call it results in the following exception:

java.lang.UnsupportedOperationException
    at com.amazonaws.services.dynamodbv2.AbstractAmazonDynamoDB.updateContinuousBackups(AbstractAmazonDynamoDB.java:380)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at com.amazonaws.services.dynamodbv2.local.embedded.DDBExceptionMappingInvocationHandler.invoke(DDBExceptionMappingInvocationHandler.java:172)
    at jdk.proxy3/jdk.proxy3.$Proxy18.updateContinuousBackups(Unknown Source)
.
.
.

Tested this with a live client and that worked as expected to might be the case that DynamoDBLocal does not consume this method.

Update continous backups code:

final UpdateContinuousBackupsRequest continuousBackupsRequest = new UpdateContinuousBackupsRequest();
continuousBackupsRequest.setTableName(createTableRequest.getTableName());

final PointInTimeRecoverySpecification pitrSpec = new PointInTimeRecoverySpecification();
pitrSpec.setPointInTimeRecoveryEnabled(true);
continuousBackupsRequest.withPointInTimeRecoverySpecification(pitrSpec);

client.updateContinuousBackups(continuousBackupsRequest);

Current work-around is to surround the last call in a try catch and ignore the exception, but this is not very sustainable :upside_down_face:

Versions:

com.amazonaws.DynamoDBLocal: 2.4.0 com.amazonaws.aws-java-sdk-dynamodb: 1.13.720 Java: 17

Thanks in advance and let me know if I should provide any more information.

/Markus

shetsa-amzn commented 5 months ago

We appreciate your feedback and we are currently reviewing this. We will update as soon as we have more information about next steps.