Critical flow
Interval testing and binding commit together. What conditions ensure the result?
Two work orders request the same technician.
Starting point The internal appointment datastore determines occupancy.
Assumptions for the example case
Fictional repair of a dripping faucet in an apartment. The order contains a fixed scope of work and a confirmed access appointment. All quantities, thresholds and operational objectives of this design are illustrative assumptions.
Collision of the same technician
Collision of the same technician
They both check the same interval.
Result: A winner; F-44 has no overlap.
The atomic interval test commits one appointment and rejects the second one.
Commit, response loss and resumption
- F-44 free
- Confirm two appointments for 09:00–10:00 in either arrival order → Exactly one is confirmed; the other receives a conflict.
- T-44 confirmed
- Repeat identically, then change start → Same appointment; changed replay conflict.
- Booked interval ends 10:30
- Follow-up appointment 10:29:59 /10:30:00 /10:30:01 → Only first collides; half-open interval limit allows the others.
Commit the interval check and allocation together.
The check and insertion are atomic.
Two work orders request the same technician.
A binds F-44, B collides. B binds F-44, A collides; exactly one appointment.
- Alternative considered
- Checking in advance and writing later allows double occupancy.
- Trade-off
- The loser is looking for an alternative.
- Reassess
- Allocating multiple resources requires a shared lock order.
Try it yourself
Predict both orders.
A hint for your attempt
Two work orders request the same technician.
Compare with a possible solution
- A first
- A binds F-44, B collides.
- B first
- B binds F-44, A collides; exactly one appointment.
Apply to your project
Where does your project need to commit a check and its allocation atomically?