conditional write
A write that only succeeds if the current value still matches a stated condition, such as the key being absent.
In more detail
Conditional writes protect small invariants in a key-value store, such as taking a lock only when it is free or claiming an idempotency key once. They make check then act atomic.
Related terms
- check then act — Reading whether something exists and then acting on the answer as two separate steps, which races under concurrency.
- optimistic concurrency control — A way to prevent lost updates by reading a version, preparing a change, and making the write succeed only if that version is still current.
- lock — A marker that gives one worker exclusive access to a resource until it releases it.
Taught in
- The Storage Decision: Key Value, Search And Blob — Scalable System Design & Distributed Architecture
- Idempotency, And Exactly Once As A Fiction — Scalable System Design & Distributed Architecture