-
Notifications
You must be signed in to change notification settings - Fork 154
Feature request: Leverage new DynamoDB Failed Conditional Writes behavior #1573
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
Comments
Hi @brnkrygs thank you for suggesting this improvement. At least on the surface the proposal makes a lot of sense, before adding it to the backlog we'll have to investigate the feasibility based on the current request flow and understand if it fits as-is or we need rearchitecting. We are going to start looking at this after we publish the first release. |
Taking a look at this issue as discussed with @dreamorosi |
Hi Andrea, A couple of changes I am proposing to change in this feature request: Implemented a custom error to contain existingRecord field here:
Error is then handled here using the code snippet below:
To make use of the existingRecord field, it is referenced here:
So the getRecord API call is not made again to fetch item that lead to failure of the conditional write, the code snippet below is removed from here:
However the removal of that code causes a couple of unit tests listed below to fail with the error =>
To fix the issue we would need to remove the unit test For now I haven't removed the getRecord because the test files were failing and wanted to inform you about them first. Other changes made to unit test file here:
|
|
This feature is available as of v1.8.0. |
Use case
The new idempotency utility uses conditional writes against DynamoDB for its locking mechanism.
When the conditional write fails, the record is considered locked and the request is already processed. In that case, a query is issued against DynamoDB to fetch the cached result and return it.
This means for this scenario that customers must wait and pay for both a write and read, even though the write fails.
On June 30, 2023, DynamoDB announced the ability for a failed conditional write to return a copy of the existing record. This would allow the package to skip performing the query, improving performance and lowering cost.
Solution/User Experience
In the idempotency utility, use the new DynamoDB conditional write behavior to return the current state of the item in the same conditional write operation. Remove the follow-up query.
Alternative solutions
No response
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: