Ch8 Sol2b: guard choice at the write boundary

Ch8 Sol2b: guard choice at the write boundary A workflow diagram generated by Archify. 01 / Guest + app 02 / Write boundary 03 / Contention + retry Decide Enforce Settle Refuse, do not double-book Write boundary Booking request · room R, [start, end) · Guest + app › Decide Booking request room R, [start, end) 409 conflict · choose another slot · Guest + app › Refuse, do not double-book › Enforce 409 conflict choose another slot Confirmed · booking id issued · Guest + app › Refuse, do not double-book › Settle Confirmed booking id issued BEGIN · one txn per attempt · Write boundary › Write boundary › Decide BEGIN one txn per attempt Rail A: room lock · FOR UPDATE on rooms · Write boundary › Write boundary › Enforce Rail A: room lock FOR UPDATE on rooms Overlap check · new range vs committed · Write boundary › Write boundary › Enforce Overlap check new range vs committed Overlap? · predicate, not equality · Write boundary › Write boundary › Enforce · invariant gate Overlap? predicate, not equality invariant gate INSERT + COMMIT · 200 booked · Write boundary › Write boundary › Settle INSERT + COMMIT 200 booked Rail B: exclusion · EXCLUDE (room =, during &&) · Contention + retry › Enforce Rail B: exclusion EXCLUDE (room =, during &&) Retry whole txn · bounded + backoff · Contention + retry › Settle Retry whole txn bounded + backoff 40001 at COMMIT overlaps no overlap hot room prefer Legend User UI Agent logic Policy Tool action Context / trace External system