-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Support of ReturnConsumedCapacity in DynamoDBEnhancedClient's BatchWrite operation #5462
Conversation
...nced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/DynamoDbEnhancedAsyncClient.java
Outdated
Show resolved
Hide resolved
.changes/next-release/feature-DynamoDBEnhancedClient-a84a047.json
Outdated
Show resolved
Hide resolved
This reverts commit a7bd547.
return BatchWriteResult.builder().unprocessedRequests(response.unprocessedItems()).build(); | ||
return BatchWriteResult.builder() | ||
.unprocessedRequests(response.unprocessedItems()) | ||
.consumedCapacity(response.consumedCapacity()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: formatting seems a bit off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
.../main/java/software/amazon/awssdk/enhanced/dynamodb/model/BatchWriteItemEnhancedRequest.java
Show resolved
Hide resolved
...-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/model/BatchWriteResult.java
Show resolved
Hide resolved
@@ -134,6 +138,16 @@ public void builder_missing_mapped_table_resource_error_message() { | |||
errorMessageDeleteKeyFromItem); | |||
} | |||
|
|||
@Test | |||
public void hashCode_includesConsumedCapacity() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use equalsVerifier to test equals and hashcode? https://github.com/aws/aws-sdk-java-v2/blob/master/core/sdk-core/src/test/java/software/amazon/awssdk/core/async/ResponsePublisherTest.java#L25
We may need to add equalsverifier
test dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test for equals and hashcode using equalsverifier
. Looks like the test dependency was already there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor comments on the javadoc. Triggering builds
} | ||
|
||
/** | ||
* The capacity units consumed by the {@code Write} operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad. Fixed
} | ||
|
||
/** | ||
* Set the capacity units consumed by the batch write operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collection metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad. Fixed
} | ||
|
||
/** | ||
* Whether to return the item collection metrics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this method does not return a boolean value though. Suggesting
Sets the item collection metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
} | ||
|
||
/** | ||
* Whether to return the item collection metrics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Any ideas why all the jdk builds are failing? |
It seems there are checkstyle erros
Could you run it locally and fix them?
|
Thank you, @zoewangg . I've made the changes to fix the build |
Quality Gate passedIssues Measures |
@all-contributors please add @prateek-vats for code |
I've put up a pull request to add @prateek-vats! 🎉 |
Motivation and Context
Currently the response returned by a BatchWriteItem and TransctWriteItem operations don't return the Capacity consumed unlike some other requests. This PR introduces that feature
Open issue: #4123
Modifications
Testing
Added unit tests and functional tests
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License