DynamoDB DYNAMODB_ERROR_PROBABILITY not working
Issue #26
resolved
I set the DYNAMODB_ERROR_PROBABILITY to 0.5, and when I refresh the DynamoDB Address, i can get the throughput exception successfully in rate 0.5
But when i batch get item or put item by java code, it always return the result successfully, can't get any throughput exception~
Any solution about this?
Comments (3)
-
Account Deactivated -
reporter - edited description
-
reporter - changed status to resolved
@w_hummer thank u for your reply.
After i download the latest docker image, this issue went away~
Here is my java code:
public static void getItem() { GetItemRequest getItemRequest = new GetItemRequest(); getItemRequest.withTableName(tableName); getItemRequest.withConsistentRead(true); getItemRequest.withReturnConsumedCapacity(ReturnConsumedCapacity.INDEXES); Map<String, AttributeValue> keyMap = new HashMap(); keyMap.put("student_id", new AttributeValue().withS("7")); keyMap.put("student_name", new AttributeValue().withS("Chris Ye")); getItemRequest.withKey(keyMap); getItemRequest.withProjectionExpression("age,big_field"); GetItemResult itemResult = AwsCredential.getDynamoDBClient().getItem(getItemRequest); System.out.println("Capacity:" + itemResult.getConsumedCapacity()); itemResult.getItem().entrySet().stream().forEach(entry -> { System.out.println(entry.getKey()); System.out.println(entry.getValue().getS()); }); }
And when i set the dynamodb_error_probability to 1,
DYNAMODB_ERROR_PROBABILITY=1 DATA_DIR=/tmp/localstack_data
i can get the throughput exceed exception successfully:
Exception in thread "main" com.amazonaws.services.dynamodbv2.model.ProvisionedThroughputExceededException: The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ProvisionedThroughputExceededException; Request ID: null) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1545) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1183) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:964) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:676) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:650) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:633) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$300(AmazonHttpClient.java:601) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:583) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:447) at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:1724) at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:1700) at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.createTable(AmazonDynamoDBClient.java:745) at dynamodb.LowerDynamoDBClientTest.createTable(LowerDynamoDBClientTest.java:141) at dynamodb.Bootstrap.main(Bootstrap.java:13)
Thank you very much~
- Log in to comment
Thanks for reporting. I was unable to reproduce your issue, given that the error injection happens regardless of the API method used, see here: https://bitbucket.org/atlassian/localstack/src/master/localstack/mock/proxy/dynamodb_listener.py?at=master&fileviewer=file-view-default#dynamodb_listener.py-20:21
Can you please provide a minimal, self-contained example of your Java code that connects to LocalStack? Thanks