# help

Adrian Schweizer

01/30/2022, 1:13 PM
Hey guys, dealing with dynamodb "look up then write" concurrency problem. It seems you can't put both a read and write dynamodb operation in the same transaction, so I've searched a bit for other solution and found the use of a lock flag in a dynamodb table and using a write with conditionexpression to try to acquire the lock, but my question is how to then wait and try to reacquire when lock could not be gotten
Or maybe you have a simpler way to deal with the problem? My concrete case is that I have to find a max value and then write an item with +1 of that value.

Ross Coundon

01/30/2022, 1:32 PM
Does this help you ?

Adrian Schweizer

01/30/2022, 1:59 PM
Not really. Sometimes you have to do a locked read and write, otherwise there wouldn't be a Java library for dynamodb locks
Ok that was formulated a bit wrong, sorry about that, what I meant is, that yes, it does help me in the actual current case, and thanks for linking me the article, but it does not solve all cases that would need a locked read and write
I guess I'm just going to implement my own mutex