1

I have an application that receive several post request at the same time and it seems my field in database are rewritten due to concurrent actions of request

How can I update fields and avoid race conditions ?

Thanks

1 Answer 1

1

What you are looking for is optimistic locking. You need one field (e.g. "Version") which gets updated everytime with an increasing number or timestamp. On request side you have to provide this version to the client so he can send you his version back. The database system can than check for equality. If so nobody else has changed the entry. If not an error is raised. Maybe this page helps you further: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.OptimisticLocking.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.