Consistency Models

Monotonic Atomic View


Monotonic atomic view is a consistency model which strengthens read committed by preventing transactions from observing some, but not all, of a previously committed transaction’s effects. It expresses the atomic constraint from ACID that all (or none) of a transaction’s effects should take place. Once a write from transaction T1 is observed by transaction T2, then all effects of T1 should be visible to T2. This is particularly helpful in enforcing foreign key constraints and ensuring indices and materialized views reflect their underlying objects.

Monotonic atomic view is a transactional model: operations (usually termed “transactions”) can involve several primitive sub-operations performed in order. It is also a multi-object property: operations can act on multiple objects in the system.

Monotonic atomic view can be totally available: in the presence of network partitions, every node can make progress. If you are willing to sacrifice total availability, both repeatable read and snapshot isolation offer stronger guarantees.

Note that monotonic atomic view does not impose any real-time constraints. If process A completes write w, then process B begins a read rr is not necessarily guaranteed to observe w. For a transactional model that provides real-time constraints, consider Strict Serializability .

Moreover, monotonic atomic view does not require a per-process order between transactions. A process can observe a write, then fail to observe that same write in a subsequent transaction. In fact, a process can fail to observe its own prior writes, if those writes occurred in different transactions.

<aside> 💡 not requre a per-process order between transactions

即使在同一个 process 内也不保证任何跨事务的顺序,一个 process 的后一个事务的读可能看不见上一个事务的写。

</aside>

Like Linearizability , monotonic atomic view allows pathological orderings. For instance, a monotonic atomic view database can always return the empty state for any reads, by appearing to execute those reads at time 0. It can also discard write-only transactions by reordering them to execute at the very end of the history, after any reads. Operations like increments can also be discarded, assuming the result of the increment is never observed. Luckily, most implementations don’t seem to take advantage of these optimization opportunities.

Formally

Monotonic Atomic View is not commonly discussed in the literature, but was coined by Bailis, Davidson, Fekete, et al in Highly Available Transactions: Virtues and Limitations. They describe it as:

Under MAV, once some of the effects of a transaction Ti are observed by another transaction Tj, thereafter, all effects of Ti are observed by Tj. That is, if a transaction Tj reads a version of an object that transaction Ti wrote, then a later read by Tj cannot return a value whose later version is installed by Ti.

In terms of Adya’s formalization of transactional isolation levels, monotonic atomic view prohibits:

And since monotonic atomic view is strictly stronger than read committed, it also prohibits the ANSI phenomena…

but allows: