Transaction Strategies for DynamoDB in Spring
Asked Answered
P

1

6

What would be the most appropriate way to enable transactionality of multi-operation updates on AWS DynamoDB in a Java Spring application?

AWS' DynamoDB is atomic only on a per-row update. I have a requirement to maintain secondary indices as separate tables, so I'd insert the 'main' row in the main table, and then insert a row into the secondary index table. If the second insert fails, I'd like to 'roll back' the first, in order to keep my data consistent. DynamoDB doesn't have any native support for transactions or rollbacks.

I'm familiar with using a Spring transaction manager when working with JPA datasources like Hibernate, but I'm not sure what the best approach to implementing my own transaction-management code would be.

Pyrene answered 14/10, 2012 at 8:52 Comment(2)
did you find any thing for rollback in dynamodb ?Tackett
Possible duplicate of Implementation of Atomic Transactions in dynamodbCysticercoid
N
3

We have a similar requirement. What we are adopting is a "polyglot" approach. That is to keep the transactional part, your main table, in a relational database. Only update your secondary indices in DynamoDB after a transaction is committed in the main table.

Nut answered 30/10, 2012 at 17:57 Comment(1)
I'm not sure I understand. If the main table is in an RDBMS, then we're not getting any of the benefits of DynamoDB?Pyrene

© 2022 - 2024 — McMap. All rights reserved.