There is a possibility to specify consistentRead attribute on GetItem of DynamoDB, which guarantees a consistent view of the underlying data. When using DeleteItem there is a possibility to request ReturnValues with property ALL_OLD, which should return the state before the actual deletion happened.
My question is, considering a concurrent dispatch of 2 or more DeleteItem requests with ReturnValues ALL_OLD on the same item, am I guaranteed to receive only a single response with the old return value and all other responses must have empty value? Or is it possible that in certain conditions, 2 or more of such concurrent requests could return the original value at the same time, if so, what would be such theoretical condition?
Important: Note that I'm NOT using optimistic locking or conditional expressions in this scenario. Eg. for conditional expressions I know the documentation states following:
Conditional writes check their conditions against the most recently updated version of the item...
source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html
All writes to DynamoDB are strongly serialised by the leader node responsible for accepting the write operations. For that reason, only one of the DeleteItem calls would return values, all others would be empty.
Likewise, using a strongly consistent read after receiving a 200 for the DeleteItem will also return an empty item {}
.
The benefit with ReturnValues is that the read costs nothing, and it returns the exact state of the item at the moment the DeleteItem occurred, not other operations can interfere.