- Newest
- Most votes
- Most comments
No, Transactions are fully ACID compliant, with an all or nothing commit. Items will never be partially updated. If one of the items in the transaction encountered a 500 exception, the entire transaction is rejected as a result.
Based on the available information, there are no edge cases where TransactWriteItems would successfully complete only some of the actions. The transactional nature of TransactWriteItems is designed to be atomic, meaning all actions either succeed or fail together.
Even in the case of an InternalServerError (500), AWS DynamoDB maintains the integrity of the transaction. The operation is designed to be all-or-nothing, which means that if any part of the transaction fails, including due to an internal server error, the entire transaction is rolled back, and no changes are applied to any of the targeted items.
It's important to note that TransactWriteItems is fundamentally different from BatchWriteItem in this regard. While BatchWriteItem can result in partial success with some items being processed and others failing, TransactWriteItems does not allow for such partial completion.
DynamoDB cancels a TransactWriteItems request under specific circumstances, such as when a condition in one of the condition expressions is not met, when tables in the request are in different accounts or regions, when more than one action targets the same item, when there's insufficient provisioned capacity, or when there are user errors like invalid data formats. In all these cases, the entire transaction is canceled, not partially completed.
While it's understandable that your team is concerned about the InternalServerError scenario, there is no evidence in the documentation or known behavior of DynamoDB that suggests the transactional nature could be compromised, even in this case. The system is designed to maintain transactional integrity even in the face of internal errors.
If you receive an InternalServerError, it's generally safe to assume that the transaction did not complete, and you can retry the operation. However, it's always a good practice to design your application to handle potential edge cases and ensure data consistency through additional checks if absolute certainty is required for your use case.
Sources
TransactWriteItems - Amazon DynamoDB
TransactWriteItem - Amazon DynamoDB
TransactWriteItems - AWS AppSync
Relevant content
- AWS OFFICIALUpdated 2 years ago
