3

Say that I want to make frequent updates to an object in DynamoDB, and I've implemented optimistic locking where we (1) read the document; (2) perform some operations including a version increment; and (3) do a conditional put where the condition is that the version hasn't changed.

If I had thousands of these kinds of requests happening, would I ever run into a situation where two put operations (x and y) proceed in parallel, both pass the condition, x finishes first, and then y overwrites what x just did? I've heard that MongoDB prevents multiple operations from changing a document at the same time, but I have no idea if the same is true for DynamoDB.

Originally, I was going to use transactWrite for this, but since it isn't enabled for global tables and that is a requirement, I'm wondering if optimistic locking will be sufficient.

J_Stan
  • 473
  • 1
  • 5
  • 14
  • transactWrite can be used on global table if one item is updated only from one region.source https://aws.amazon.com/blogs/aws/new-amazon-dynamodb-transactions/ – best wishes Jun 20 '19 at 03:28
  • Yes I know, but I need global tables as my post indicates – J_Stan Jun 20 '19 at 12:11

0 Answers0