Concept page: Hierarchy of consistency models — linearizability, serializability, snapshot isolation, causal, eventual. One topology with 2 clients + coordinator + 3 DB replicas. Four scenarios: linearizable strong-quorum read/write; eventual stale read from replica-2; causal read-your-writes via session token; write-skew bug under snapshot isolation (doctor on-call invariant).
“Strong” and “weak” hide several independent questions. State the object or transaction, the order being promised, the failure assumptions and the client-visible anomalies.
Linearizability is a real-time correctness condition for concurrent object operations. Each operation appears to take effect at one point between invocation and response, and the total order respects real-time precedence. If a write completes before a read starts, that read cannot return an older value.
A quorum inequality alone is not an implementation proof. Leaders, consensus, read-index or lease rules, version ordering, membership changes and completion acknowledgements determine whether the protocol is linearizable.
Serializability is a transaction property: committed transactions have the same effect as some serial execution. It does not by itself require that this serial order respect real-time order between transactions. Strict serializability combines serializability with real-time precedence.
Therefore serializability and linearizability are not simply adjacent rungs. One describes multi-operation transactions; the other describes concurrent object histories, and a system can provide different combinations.
Causal consistency preserves potential cause before effect: a reply should not become visible before the post it depends on. Unrelated concurrent operations need not receive one global order. Implementations carry dependency/version metadata or make a replica wait until predecessors are visible.
Session guarantees such as read-your-writes and monotonic reads are client-scoped contracts. They may require sticky routing, a session token, waiting, or forwarding to a sufficiently advanced replica. They are not implied by eventual convergence.
A useful eventual-consistency contract states the conditions: if updates stop and relevant messages are eventually delivered, replicas converge. Concurrent writes still need a deterministic merge, convergent data type, application conflict, or declared winner. Replication alone does not prevent lost updates.
Isolation levels describe transaction anomalies, not replica freshness:
External calls inside a retried transaction can duplicate effects. Commit first and publish through an outbox, or use an idempotent external operation and reconciliation.
A later read respects a completed write on one register.
A reply waits for the post identified by its dependency token.
Concurrent commutative updates converge under eventual delivery.
Two disjoint writes violate a cross-row invariant under snapshot isolation.
A serialization failure aborts safely and the whole transaction retries.
Введите числа или выберите пресет