Vetora logo

Consistency & Transactions

ACID, isolation levels, and consistency models in distributed systems.

Concepts

LinearizabilityP0

Linearizability is the strongest single-object consistency model, requiring that every operation appears to take effect instantaneously at some point between its invocation and response. It makes a distributed system behave as if there is a single copy of the data, even though it is replicated across multiple nodes.

SerializabilityP0

Serializability is the strongest isolation level for database transactions, guaranteeing that the outcome of executing transactions concurrently is equivalent to some serial (one-at-a-time) execution. It prevents all concurrency anomalies -- dirty reads, non-repeatable reads, phantom reads, and write skew.

Eventual ConsistencyP0

Eventual consistency is a consistency model guaranteeing that if no new updates are made to a data item, all replicas will eventually converge to the same value. It is the default model for many distributed databases (DynamoDB, Cassandra) and is the consistency counterpart to high availability in the CAP trade-off.

Read-Your-Writes ConsistencyP0

Read-your-writes consistency (also called session consistency) guarantees that after a client performs a write, that same client will always see the result of that write in subsequent reads. It does not guarantee that other clients see the write immediately, making it strictly weaker than linearizability but stronger than basic eventual consistency.

Snapshot IsolationP0

Snapshot isolation (SI) is a multi-version concurrency control (MVCC) technique where each transaction reads from a consistent snapshot of the database as of its start time. Reads never block writes and writes never block reads, providing excellent read performance while preventing most concurrency anomalies -- except write skew.

Database Isolation LevelsP0

Isolation levels define how and when changes made by one transaction become visible to other concurrent transactions. The SQL standard defines four levels -- Read Uncommitted, Read Committed, Repeatable Read, and Serializable -- but real-world implementations (snapshot isolation, SSI) diverge significantly from the standard's definitions.

Two-Phase Commit (2PC)P0

Two-phase commit (2PC) is a distributed transaction protocol that ensures all participating nodes either commit or abort a transaction atomically. A coordinator asks all participants to prepare (Phase 1), then instructs them to commit or abort based on their responses (Phase 2). 2PC guarantees atomicity but blocks if the coordinator fails after Phase 1.

Saga PatternP0

The Saga pattern manages distributed transactions in microservices by breaking them into a sequence of local transactions, each with a compensating action (undo). If a step fails, previously completed steps are compensated in reverse order. Sagas provide eventual consistency without the blocking behavior of 2PC.

IdempotencyP0

An operation is idempotent if executing it multiple times produces the same result as executing it once. Idempotency is essential for building reliable distributed systems because network failures, retries, and message duplication are inevitable -- idempotent operations ensure that retries are safe and do not cause unintended side effects.