1 Answer
- Newest
- Most votes
- Most comments
1
DynamoDB does not do any reads when executing a write operation. Furthermore, it provides serializable isolation, so when you execute 2 requests concurrently, one of those items will get executed before the other and the second request will always see the most up to date data (the results of the first request).
I suspect that perhaps there is an issue in your logic when executing the requests, as both values should exist when all processes are complete. Ensure you are not overwriting data by calling PutItem etc...
Relevant content
- asked a year ago
- Accepted Answerasked 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
I think you misunderstood. I am not doing two operations. I do only a single operation, which is
UpdateItem
. Which, I was thinking does reading by itself since it needs to resolveif_not_exists
inupdateExpression
.Understood, but my answer remains relevant. DynamoDB does not read, there's no consistency at play. All write operations go to the leader node of a partition, meaning it will only see the most up-to-date values for that item.
if_not_exists
is resolved at the underlying storage level, on the SSD disk, in a serializable way. All single operation writes (PutItem, UpdateItem, DeleteItem) provide full ACID guarantees.