MVCC (Multi-Version Concurrency Control) concept page. Каждая строка хранит несколько версий (xmin/xmax). Транзакции читают консистентный snapshot на момент start. Postgres, Oracle UNDO, SQL Server RCSI, MySQL InnoDB UNDO log, Spanner timestamp KV. Цена: bloat, VACUUM/cleanup overhead, txid wraparound risk при long-running txn. 4 сценария: stable snapshot read, write skew under SI, autovacuum cleanup + bloat от long-running txn, txid wraparound катастрофа. ADR: MVCC vs locking-based READ COMMITTED (Postgres vs SQL Server до RCSI).</description> <parameter name="name">MVCC: Multi-Version Concurrency Control
MVCC хранит несколько logical versions и применяет visibility rules. Корректность определяется isolation level, snapshot boundary, conflict detection и lifecycle старых versions, а не лозунгом «readers never block writers».
| Компонент | Ответственность |
|---|---|
| Reader Transaction | Получает statement или transaction snapshot по isolation level. |
| Writer Transaction | Создаёт новую tuple version и может ждать locks/conflicts. |
| Snapshot and XID State | Определяет visible committed/in-progress transactions и horizon. |
| Tuple Versions | Содержит current и obsolete physical tuples до cleanup. |
| Row and Predicate Conflicts | Сериализует incompatible writes и поддерживает stronger isolation. |
| Vacuum and Freeze | Удаляет reusable dead versions и предотвращает XID wraparound. |
| Transaction Age Monitor | Находит long transactions, bloat и wraparound risk. |
Two SELECT statements in one PostgreSQL READ COMMITTED transaction can see different committed states because each command obtains a new snapshot.
Проверяемый исход: The lesson no longer fixes READ COMMITTED visibility at transaction start.
At REPEATABLE READ, subsequent reads use the transaction snapshot. A concurrent committed replacement remains invisible until this transaction ends.
Проверяемый исход: Repeatability is scoped to the transaction snapshot and does not imply serializability of all invariants.
Two transactions read disjoint rows and each writes one row, violating a cross-row invariant under snapshot isolation. Serializable conflict detection aborts one execution.
Проверяемый исход: The application retries the complete side-effect-free transaction on serialization failure.
A long transaction keeps old versions potentially visible. Vacuum cannot reclaim them, so table/index bloat and XID age increase.
Проверяемый исход: Monitoring terminates or fixes the owner deliberately; vacuum is not blamed for violating an active snapshot.
Числа выше — учебные inputs или размерностные формулы. Их нельзя выдавать за benchmark или SLA конкретного продукта.
[CONCEPT]exactly-once-semantics
Диаграмма показывает причинные границы и recovery contracts, а не скрытую реализацию конкретного managed-сервиса. Любая stronger guarantee действует только в явно названной transaction/checkpoint/acknowledgement boundary.
Введите числа или выберите пресет