You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(idempotency): leverage new dynamodB Failed conditional writes behavior (#1779)
* created custom error with existingRecord field
* fetch items in DB on ReturnValuesOnConditionCheckFailure
* custom error field to fetch original Item from failed Item from Db
* set base persitence layer to undefined.
* converted error type to IdempotencyRecord
* dev branch commit and unit tests
* pull request corrections
* chore: remove comment
* chore: simplify conditional item hydration
* chore: rebase
* fix: use returned items + tests
* add info about ReturnValuesOnConditionCheckFailure and conditional expression
---------
Co-authored-by: Andrea Amorosi <[email protected]>
Co-authored-by: Alexander Schueren <[email protected]>
Copy file name to clipboardExpand all lines: docs/utilities/idempotency.md
+5-4
Original file line number
Diff line number
Diff line change
@@ -109,10 +109,11 @@ If you're not [changing the default configuration for the DynamoDB persistence l
109
109
Larger items cannot be written to DynamoDB and will cause exceptions.
110
110
111
111
???+ info "Info: DynamoDB"
112
-
Each function invocation will generally make 2 requests to DynamoDB. If the
113
-
result returned by your Lambda is less than 1kb, you can expect 2 WCUs per invocation. For retried invocations, you will
114
-
see 1WCU and 1RCU. Review the [DynamoDB pricing documentation](https://aws.amazon.com/dynamodb/pricing/){target="_blank"} to
115
-
estimate the cost.
112
+
Each function invocation will make only 1 request to DynamoDB by using DynamoDB's [conditional expressions](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ConditionExpressions.html){target="_blank"} to ensure that we don't overwrite existing records,
113
+
and [ReturnValuesOnConditionCheckFailure](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html#DDB-PutItem-request-ReturnValuesOnConditionCheckFailure){target="_blank"} to return the record if it exists.
114
+
See [AWS Blog post on handling conditional write errors](https://aws.amazon.com/blogs/database/handle-conditional-write-errors-in-high-concurrency-scenarios-with-amazon-dynamodb/) for more details.
115
+
For retried invocations, you will see 1WCU and 1RCU.
116
+
Review the [DynamoDB pricing documentation](https://aws.amazon.com/dynamodb/pricing/){target="_blank"} to estimate the cost.
0 commit comments