colombia-dev / bookclub

Grupo de Lectura de ColombiaDev
38 stars 0 forks source link

Designing Data-Intensive Applications: 7. Transactions #12

Open guilleiguaran opened 5 years ago

guilleiguaran commented 5 years ago

Esta semana a cargo @guilleiguaran Siguiente semana @duende84

guilleiguaran commented 5 years ago

Transactions

ACID

Weak Isolation levels

Read Committed

Implementation

Snapshot isolation and repeteable read

Implementation

Lost Updates

Atomic operations

UPDATE counters SET value = value + 1 WHERE key = 'key'

Explicit locking

BEGIN TRANSACTION
SELECT * FROM users WHERE id = '1' FOR UPDATE
UPDATE users SET username = 'guille' WHERE id = '1'
COMMIT;

Automatic detection of lost updates

compare-and-set

UPDATE wiki.pages SET content = 'new content' WHERE id = 123 AND content = 'old content'

Write skews and phantoms

Phantoms causing write skews.

Serializability

Serial execution

Two-Phase Locking (2PL)

Performance of 2PL

Index-range locks.

Serializable Snapshot Isolation (SSI)