Two Technicians Cannot Both Reserve the Last Kit

A successful read does not reserve the stock it showed. Put the expected version and remaining-stock rule inside the actual write.

13 sections · 4 questions · 1 coding challenge

1 / 13

Testing the Precondition at the Write Boundary

BOTIE

A read followed by an unconditional write leaves a gap in which another writer can change the record. Conditional updates address that gap by making the check part of the write operation. DynamoDB condition expressions and MongoDB update filters are concrete database interfaces for this idea.

This is the same concurrency problem encountered in the SQL versioned update. The syntax changes, while the reasoning stays useful: the application states which existing state would make its proposed action valid, and the database checks that condition atomically within the operation’s supported scope.

Sources for this history