Serializability deep dive — concept page covering SQL isolation levels, write skew anomaly, SSI in Postgres, Strict 2PL with deadlock detection, and OCC. Multi-scenario FlowBuilder: SERIALIZABLE happy path with disjoint writes, write skew under SNAPSHOT ISOLATION (doctors on-call invariant broken), SSI abort 40001 with client retry, and 2PL deadlock with InnoDB victim selection. Topology: Postgres group with tx-mgr (MVCC + SSI), heap (row versions), serialization graph (rw-deps), plus T1/T2 clients. ADR on tx-mgr explaining when to use SERIALIZABLE vs SI/RC + SELECT FOR UPDATE.
Serializable isolation constrains every successfully committed transaction in the participating set to have the same effect as some serial execution. It does not mean that transactions run one at a time, and it does not make an application correct unless each transaction preserves the invariant when run alone.
Snapshot isolation can admit write skew when transactions read overlapping predicates and write disjoint rows. PostgreSQL Serializable Snapshot Isolation tracks read/write dependencies and may abort a transaction; applications must retry the whole transaction and must not publish external side effects before commit.
Write skew under snapshot isolation. Two transactions can read the same valid snapshot, update disjoint rows, and jointly violate an invariant.
SSI abort and whole-transaction retry. Dependency monitoring prevents the bad committed set by aborting an attempt; the application restarts all of its logic.
Explicit common guard lock. A shared guard row serializes competing paths only when every path follows the same locking protocol.
Mixed isolation hole. One serializable participant cannot protect an invariant from a concurrent weaker or external participant.
SELECT FOR UPDATE универсальным лекарством от predicate/write-skew: все пути должны блокировать общий объект, которого может не существовать без отдельной guard row.Введите числа или выберите пресет