Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB global user table transaction

I'm re-exploring the world of AWS and I know global tables don't support transactions so I am not sure how to solve this problem. I have a USER global table that stores information about my user with the USERNAME being the partition key. One edge case I am worried if USER A creates a new account with username = "BOB" and USER B comes a second later and creates a new account with the same "BOB" before the first account was written to the table and replica tables, would USER B override this account or what would exactly occur?

This is just one example, I am trying to apply the same concept to my other tables.

like image 290
user2924127 Avatar asked Dec 22 '25 02:12

user2924127


1 Answers

From the docs:

If applications update the same item in different Regions at about the same time, conflicts can arise. To help ensure eventual consistency, DynamoDB global tables use a last writer wins reconciliation between concurrent updates, in which DynamoDB makes a best effort to determine the last writer. With this conflict resolution mechanism, all the replicas will agree on the latest update and converge toward a state in which they all have identical data.

Based on the above, DynamoDB will make best effort to determine the last writer, in that case USER B. Then all replicas will agree on that and use USER B's data as the final result.

The key phrase is best effort. So its not guaranteed that it will always happen that way.

like image 108
Marcin Avatar answered Dec 25 '25 09:12

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!