← The Books

What You Can Promise Alone

When a machine cannot stop to check with the others on every change, what can it still promise on its own? That no one sees a reply before the message it answers? That no one sees a change half made? That two writers who each read a value and write it one higher never lose one of the two?

We find out by exploring what the libraries of the scholars' coast could still promise the readers of their compendium on days when the couriers between them stopped running.

We find out by asking what a replica can still promise its clients when it must always answer: which guarantees it can keep on its own while the network between replicas is partitioned, and which it cannot.

After Peter Bailis, Aaron Davidson, Alan Fekete, Ali Ghodsi, Joseph M. Hellerstein and Ion Stoica, Highly Available Transactions: Virtues and Limitations, 2014

The front of a small library across its bare terrace in the late afternoon: the librarian hands a scroll to a scholar in the porch, while a courier in blue sits on a stone in the foreground with his bundle, in no hurry
Where this book sits
Draws on

Each link is an idea one paper took from another. Point at one, or tap it, to read how.

a paper this book retells a paper retold in another book a paper outside the series

The scholars' coast from the air: small red-roofed libraries in clearings among olive groves, linked by a pale road and footpaths, the long stoa beside the shore and a town on the point beyond
The reading roomsThe model

A library, a reader, and no courierA replica, a client, and no network

Every library on the scholars' coast has a reading room where readers consult the entries of its copy of the compendium, and where scholars correct them. Word of what other libraries have done arrives by courier, and a courier can be stopped at any time, cutting one library off from the rest for as long as the stoppage lasts.*Every replica of the database serves clients: they read data, write updates, or run transactions against it. News of what other replicas have done arrives by message, and messages can be dropped or delayed at any time, cutting one replica off from the rest for as long as the partition lasts.

Answered from its own copyA library must answer every reader who comes through the door from its own copy of the compendium alone.Answered locallyA replica must answer every client that reaches it using only what is in its own copy of the data.
For as long as they likeCouriers between libraries may be stopped for hours, days, or months.For as long as it lastsMessages between replicas may be cut off for hours, days, or months.
Every visit finishesA library may never turn a reader away with come back when the couriers return; every visit must finish its business unless the reader chooses to withdraw it.Every transaction finishesA replica may never reject a client with try again when the network returns; every transaction must finish its business unless the client chooses to abort it.
The standard

The couriers stopThe network stops

A library makes a promise alone (high availability) when every reader who can reach an open library has their business done, whichever couriers are stopped and however long they stay stopped.What does it mean for a replica to make a promise alone (high availability)? It means that every client that can reach a running replica gets its transaction completed, no matter which messages are lost or how long the partition lasts.

A library that has to wait for a majority of the coast, as the Chamber and the Tholos do, cannot answer when cut off. Nor does it count to say I am probably right, as the coast's odds do.* The question here is which hard promises hold even on the day every courier on the road is stopped.A replica that has to wait for a majority (as consensus protocols do) cannot answer when cut off. Nor does it count to say I am probably right, as with probabilistic staleness.* Here we ask which hard, deterministic promises hold even when every message is lost.

Replying your request is refused does not count as answering either: if refusing every visitor counted, a locked door would be available. Under transactional availability, every visit that reaches an open library must truly complete (commit), unless the reader chooses to cancel it.Furthermore, simply replying I abort your request does not count as availability! If refusing every client counted as answering, a replica that rejected every request would be “available.” Under transactional availability, every transaction that reaches a running replica must genuinely complete (commit), unless the client itself chooses to cancel it.

On a library's porch: a scholar asks a question at the open double doors and the librarian answers from the doorway, a courier's bundle on the paving
What a reader might wantWhat a client might want

A reader's visitA client's transaction

A reader's business at a library is a visit (a transaction): in one visit, a reader may consult several entries and correct several before going out of the door.A client's business at a replica is a transaction: during a single transaction, a client may read several items and write several items before it commits.

When we test every classic transactional and session guarantee against a courier stoppage, they sort cleanly onto three shelves:When we test every classic transactional and session guarantee against a network partition, they sort cleanly into three groups:

Kept alone, by any libraryKept alone, by any replica

Whatever the couriers do (HAT)Whatever the network does (HAT)

No correction is shown half made (Read Committed). Corrections bound together are seen all or none (Monotonic Atomic View). Reading the same entry twice in a visit gives the same answer (Cut Isolation). No answer is older than a previous visit's (Monotonic Reads), and no answer is shown before the entry it answers (Writes Follow Reads).No write is shown half-made (Read Committed). A transaction's writes are seen all or none (Monotonic Atomic View). Reading the same item twice in a transaction gives the same answer (Cut Isolation). No read is older than a previous one (Monotonic Reads), and no reply is shown before the message it answers (Writes Follow Reads).

Kept if the reader stays with one libraryKept if the client stays with one replica

The same door every time (Sticky)The same replica every time (Sticky)

A returning reader sees the corrections they themselves left (Read Your Writes), in the order they left them (PRAM), together with everyone else's questions and answers (Causal Consistency).A returning client sees the writes it made itself (Read Your Writes), in the order it made them (PRAM), and combined with everybody else's messages and replies (Causal Consistency).

Kept by no library aloneKept by no replica alone

Needs news from elsewhere (Unavailable)

Two scholars who each read a count and write it one higher never lose one of the two (Lost Update), two scholars never leave an entry with no source (Write Skew), and the version handed over is the newest, or within any fixed time of the newest (Recency, Linearizability).Two clients that each read a counter and write it one higher never lose an increment (Lost Update), two clients never break a constraint between items (Write Skew), and the value returned is guaranteed to be the newest, or within any fixed time of the newest (Recency / Linearizability).

Taken shelf by shelf, the first two show how a library keeps its promises without waiting for a courier, and the third why no library can keep them alone.Let us walk through each group in turn and see how a replica keeps the promises in the first two groups without waiting for a message, and why no replica can keep the promises in the third.

The most basic promise

No half-made correctionsNo half-made writes

Suppose a scholar sits in a reading room correcting three entries in one visit. While the second correction is still being written, and before the scholar has decided whether to finish the visit or tear up the notes, another reader comes in and asks for the first entry.Suppose a client is revising three items during a single transaction. While it is still writing the second item, and before it has decided whether to commit or abort, another client asks for the first item.

The library must never show a reader an unfinished or abandoned correction (dirty read). Keeping that promise (Read Committed) needs no help from other libraries: the library keeps a visitor's corrections aside on a desk until the visit is declared complete, and only then puts them into its copy, or throws them away if the visitor withdraws.The replica must never show another client an unfinished or abandoned write (dirty read). Keeping that promise (Read Committed) requires zero help from other replicas: the replica simply holds a transaction's writes aside until the client declares the transaction complete, and only then exposes them (or discards them if the client aborts).

A second, smaller promise

Every correction in a visit carries the same tallyEvery write in a transaction carries the same timestamp

Two scholars at two cut-off libraries may each correct entries X and Y in one visit. If one scholar's correction stood on X and the other's on Y, the copies would end with a mixture neither intended (dirty write, G0). Every correction in a visit carries one shared tally, the visit's hour and the library's number, and the larger tally stands,* so whichever visit has the larger tally stands on both X and Y.What if two clients at two cut-off replicas both write items X and Y in a single transaction? If one transaction's write won on X while the other's won on Y, the data would end up with a mixture of the two (dirty write / G0) that neither client intended. By stamping every write in a transaction with a single shared timestamp (the transaction's timestamp plus the client's ID) and resolving clashes by largest timestamp,* whichever transaction has the larger timestamp wins on both X and Y.

Proof · that Read Uncommitted and Read Committed are achievable with high availability

High availability: every client that can reach a non-failing replica gets a response, without that replica contacting any other. Read Uncommitted (Adya's PL-1) forbids G0: a cycle in the graph with an edge from Ti to Tj when Tj overwrites a write of Ti. Read Committed (PL-2) also forbids reading aborted or intermediate writes (G1a–c). Claim. Both can be provided with high availability.

  1. This is §5.1.1. Read Uncommitted (Adya's PL-1) requires that writes to each object are totally ordered and that the order is consistent across objects: the graph of transactions with an edge from Ti to Tj when Tj overwrites Ti's write must have no cycle (no G0). Mark every write of a transaction with one timestamp unique across transactions (a client's identifier combined with a sequence number) and let each replica apply last-writer-wins by timestamp.
  2. Then for any two transactions T1 and T2 that write to the same two items x and y, all of T1's writes carry the same timestamp, and so does all of T2's; whichever has the larger timestamp wins on both. It cannot happen that wx(1) precedes wx(2) while wy(2) precedes wy(1). No replica contacts any other to decide, so every replica can respond.
  3. Read Committed (PL-2) adds that no transaction reads uncommitted or intermediate versions (Adya's G1a–c). A client buffers its writes until it commits, or sends them to a server that does not reveal them to other readers until it is notified of the commit. Then a reader is never shown a write of a transaction that later aborts, nor an intermediate write.
  4. This provides no recency or monotonicity, and the paper notes it satisfies the implementation-agnostic definition rather than the lock-based behaviour of centralised implementations.∎
All or none

Corrections bound togetherWrites bound together

Suppose a scholar adds two things in one visit: a new entry X, on the comet's path, and in the entry Y on the comet a cross-reference to X. The courier carrying X may reach a library before the courier carrying Y, or the other way round.Suppose a client writes two items in one transaction: it updates item X (a map) and also item Y (a guide that refers to X). When messages carry those two writes across the system, the message carrying X might reach a replica before the message carrying Y.

A reader who saw the new Y but not yet X would follow a reference to an entry that is not there (fractured read). To prevent that (Monotonic Atomic View), the scholar binds the corrections of a visit under one cord: each carries the visit's tally and a list of every entry corrected in the visit. A library does not show an arriving correction at once; it keeps it in the back room until it knows that every correction under the cord has reached all the libraries (pending stable), and until then it shows readers the older versions.If a client saw the new X and then read the old Y, it would see a broken half-state (fractured read). To prevent that (Monotonic Atomic View), the client tags the writes of a transaction with one manifest: each write carries the transaction's timestamp and the list of all items written in it. A replica does not expose an incoming write the moment it arrives; it holds the write aside until it knows that every write of that transaction has reached all the replicas (pending stable), and until then it continues to return the older versions!

A reader asks for X, then for Y the correction to X has arrived at Library 1; the correction to Y is still on the road to Library 2A client reads X, then Y the write to X has arrived at replica 1; the write to Y is still in transit to replica 2

The reader has asked for nothing yet.The client has read nothing yet.

Holding back is not waiting

A library never makes a reader wait; it only delays showing new arrivalsThe replica never makes a client wait; it only delays exposing new arrivals

This is what keeps the promise available: when a reader asks for X or Y while the couriers are stopped, the library answers at once from the older versions, which are complete in its copy. Once every library has the whole cord, the new versions may be shown, and once a reader has seen any entry from a cord, the reader's note of the visit records the cord's tally, so any other library asked in the same visit shows at least that cord's versions.Notice the trick that makes this highly available: when a client reads X or Y during the partition, the replica answers immediately using the older, pre-transaction version that is already complete. Once every replica has received all the writes of the transaction, the new versions become eligible to show; and once a client sees any item from a transaction, its session records that transaction's timestamp so any other replica it asks in the same transaction also shows it at least that version.

Sketch · that Monotonic Atomic View is achievable with high availability

Monotonic Atomic View (MAV): once some effect of a transaction Ti is observed by a transaction Tj, all later reads of Tj observe all of Ti's effects, or later versions. A write is pending stable once every replica for the transaction's final writes has received them. Claim. MAV can be provided with high availability.

  1. This is the algorithm sketched in §5.1.2. MAV requires that once some effect of a transaction Ti is observed by Tj, all later reads of Tj observe all of Ti's effects (or later versions): if Tj reads a version written by Ti, a later read cannot return an earlier version of an item Ti wrote.
  2. Begin with the Read Committed algorithm. Replicas withhold new writes from readers until all replicas for the final writes of the transaction have received them (the writes are pending stable). Each write carries the transaction's single timestamp and the list of items written.
  3. When a client reads an item, the returned timestamp and item list give a lower bound on the versions the client must read for the other items in the list. The client attaches the current bound to each later request.
  4. A replica responds with a write matching the bound or a pending-stable write with a higher timestamp. Each replica holds, per item, the highest pending-stable write and the set of writes not yet pending stable. Since the bound refers only to writes already pending stable, which every replica holds, a replica can always respond, so the algorithm is master-less and operations never block on replica coordination.
  5. The paper gives the full algorithm in its technical report; this is its outline.∎
Within a visit, and across visits

The same answer twice

A reader who asks for the same entry twice in one visit should see the same version both times (Item Cut Isolation, Repeatable Read).What if a client reads the same item twice during a single transaction and wants to see the exact same version both times (Item Cut Isolation / Repeatable Read)?

That is easy: the reader, or the reading room, notes the version shown the first time and hands back that copy if the reader asks again in the visit, unless the reader corrected it meanwhile. Keeping older versions in the back room, a library can do the same for a whole list of entries on one subject (Predicate Cut Isolation).That is effortless: the client (or its session) simply remembers the version returned by the first read, and if it reads that item again during the same transaction, returns the cached copy (unless the client itself modified it during the transaction). By keeping older versions around, the replica can do the same for a whole set of items matching a condition (Predicate Cut Isolation).

Across visits a reader may go to Library 1 today and Library 2 tomorrow, and never wants to see a version older than one already read (Monotonic Reads). Without keeping to one library, the coast can promise this by having every library show readers only its floor: the newest version the library knows every library on the coast already holds.What about across transactions, when a client may read from replica 1 today and replica 2 tomorrow, and never wants to see an older version than one it read before (Monotonic Reads)? Even without sticking to one replica, the system can guarantee this by having every replica show clients only its stable version: the highest version that the replica knows every replica has already received!

A library seen from above among olive trees and cypresses: a scholar walks along the path beside it with a scroll

The floor only rises three libraries; a reader may ask any of themThe stable version only rises three replicas; a client may read any of them

1the floor: the version every library holdsthe stable version: the version every replica holds1the newest version anywherethe newest version anywhere

Every library holds version 1, and shows it.Every replica holds version 1, and shows it.

No library shows a version until every library holds it, so a reader who walks from any library to any other never steps backwards. The price is staleness: while couriers are stopped the floor stops rising, and every library keeps showing the old floor, even to the scholar who has just written a new version.Because no replica reveals a version until every replica holds it, a client that moves from any replica to any other can never read an older version. The price is staleness: during the partition, the stable version stops rising, so every replica keeps showing the old pre-partition version, even to the very client that just wrote a new one!

A library's porch seen low along its length: a scholar sits on the step reading a scroll, a small wax tablet beside him, the open doors and the row of columns behind
The second shelfThe second group

Staying with one libraryStaying with one replica

Suppose a reader leaves a correction at Library 1, goes out while the couriers are stopped, and comes back the next morning to read the entry (Read Your Writes).Suppose a client writes at replica 1, disconnects during the partition, and reconnects later to read the item (Read Your Writes).

A reader who walks into Library 2, cut off from Library 1, finds that Library 2 has never heard of the correction. It cannot wait for the couriers; it must answer from its own copy, which holds only the old version. So no library can promise a reader their own corrections if the reader moves between libraries that are cut off from each other.If it reads from replica 2, which is cut off from replica 1 by the partition, replica 2 has never received its write! Under high availability, replica 2 cannot wait for messages to resume; it must answer from its own data, which holds only the old version. Thus no system can guarantee Read Your Writes if a client switches between partitioned replicas.

To get Read Your Writes, the reader must stay with one library (sticky availability), coming back to the same door each visit, or carry copies of their own corrections to show any other library, which amounts to the same thing.To get Read Your Writes, the client must stay with one replica (sticky availability), returning to the same replica each time, or else carry copies of its own writes along to show any new replica it visits (which amounts to acting as its own sticky replica).

Where does the reader come back? a correction left at Library 1, and the couriers stoppedWhich replica does the client return to? a write made at replica 1, and the network partitioned

Leave a correction at Library 1 first.Write at replica 1 first.

What is promised

A reader who stays with one library always sees their own correctionsA client that stays with one replica always sees its own writes

When a reader sticks to one library, that library already holds every correction the reader ever wrote, in the exact order they wrote them (PRAM consistency). The only catch is that if that one library burns down or closes its doors, the reader's unpropagated corrections are trapped inside until it reopens.When a client sticks to one replica, that replica already holds every write the client ever made, in the exact order it made them (PRAM consistency). The only catch is that if that one replica crashes, the client's unpropagated writes are stuck at that replica until it recovers.

Proof · that Read Your Writes is not achievable with high availability, and is with sticky availability

Read your writes: whenever a client reads an item after updating it, the read returns the updated value or one that overwrote it. Sticky availability: a client always reaches the same replica, and gets a response whenever it can. wx(1) is a write of 1 to item x, and rx(a) a read of x returning a. Claim. Read your writes cannot be provided with high availability, and is provided with sticky availability.

  1. This is §5.1.3. Read your writes requires that whenever a client reads an item after updating it, the read returns the updated value or one that overwrote it. Consider a client that executes T1 : wx(1) and then T2 : rx(a).
  2. Suppose the client executes T1 against a server partitioned from all others. For transactional availability the server must allow T1 to commit.
  3. If the network topology then changes so that the client can execute T2 only on a different replica, partitioned from the one that executed T1, that replica has no way to learn of wx(1). By transactional availability it must respond, so it either stalls indefinitely, violating availability, or returns a value other than 1 or one that overwrote it, violating read your writes.
  4. If the client remains sticky with the server that executed T1, that server holds the write and the scenario is excluded. So read your writes, and with it PRAM (monotonic reads, monotonic writes and read your writes) and causal consistency, require stickiness and are provided by default in a sticky system.∎
Other people's writingOther clients' writes

Questions and answersMessages and replies

Suppose a scholar at Library 1 adds an entry that raises a question, and a scholar at Library 2 reads it and adds an entry that answers it. The courier carrying the answer may reach Library 3 before the slow courier carrying the question.Suppose a client at replica 1 writes a message, which is stored as an item. A second client at replica 2 reads that message and writes a reply. What if the update carrying the reply reaches replica 3 before the slower update carrying the original message?

To promise that no answer is ever shown before the entry it answers (Writes Follow Reads, Causal Consistency), each new entry carries a note of the versions its writer had read before writing it (causal dependencies). When the answer reaches Library 3 first, Library 3 keeps it in the back room and does not show it until the entry it depends on has arrived too. All the while, Library 3 goes on answering readers at once from the entries already in its copy.To promise that no reply is ever shown before the message it answers (Writes Follow Reads / Causal Consistency), each new write carries a list of the versions its author had read before writing it (causal dependencies). When the reply arrives at replica 3 ahead of the message, replica 3 holds the reply aside and does not expose it until the message it depends on has also arrived. All the while, replica 3 continues answering clients immediately from the data it already has.

At the reader's library the answer arrives firstAt the client's replica the reply arrives first

Neither has arrived.

The ceiling of what can be promised without waiting

Causal consistency plus atomic views is as strong as a sticky library can goCausal consistency plus atomic views is as strong as a sticky replica can go

The first two shelves together, holding back incomplete cords (MAV), holding back answers until the entries they answer arrive (Writes Follow Reads), and keeping each reader at one library (Read Your Writes, Monotonic Reads and Writes), give transactional Causal Consistency. Anything stronger is on the third shelf, where no library can keep the promise alone.Combining the first two groups, holding back half-made or incomplete transactions (MAV), holding back replies until the messages they answer arrive (Writes Follow Reads), and keeping each client at one replica (Read Your Writes + Monotonic Reads/Writes), gives transactional Causal Consistency. Anything stronger crosses into the third group, where no replica can keep the promise alone.

The third shelfThe third group

A count read and written overA counter read and written over

The third shelf holds promises that no library can keep while the couriers are stopped. The compendium's entry on the stars says how many stars have been catalogued: 850. A scholar who catalogues a new star reads the entry and writes it one higher.Now we reach the third group: promises that no replica can keep while the network is partitioned. Suppose a counter holds the value 850, and clients increment it by reading the value and writing it back one higher.

The couriers are stopped. A scholar at Library 1 catalogues a new star in the same hour as a scholar at Library 2 catalogues another.During a partition, a client at replica 1 and a client at replica 2 each increment the counter at the same time.

Each scholar reads 850 in their library's copy and writes 851 (Lost Update). Neither library can learn of the other's change while the couriers are stopped, and when they return, the version with the larger tally stands: 851, for two new stars. Any rule that prevented this, such as locking the entry or waiting for a majority of libraries, would make at least one library stall or turn its reader away while the couriers are stopped.Each reads 850 and writes 851 (Lost Update). Neither replica can learn of the other's write during the partition, and when it heals, last writer wins: 851, for two increments. Any rule that prevented this, such as locking the item or waiting for a majority of replicas, would force at least one replica to stall or reject its client during the partition.

A library on the hill seen through olive trees in the late afternoon: a scholar reads in its porch, and in the foreground a courier sits on a stone under the olives with his bundle beside him

One count, two libraries each reads the entry, then writes it one higherOne counter, two replicas each reads the value, then writes it one higher

The entry says 850 at both libraries.

The same failure with two works

An entry left without a source (Write Skew)A constraint broken (Write Skew)

Every entry must keep at least one source. The entry on the comet has two, X and Y. While the couriers are stopped, a scholar at Library 1 sees that Y stands and strikes X, and a scholar at Library 2 sees that X stands and strikes Y. Each visit kept the rule by what it could see, and together they left the entry with no source at all.Suppose two items X and Y are kept under a rule that at least one of the two must remain. During the partition, a client at replica 1 checks that Y remains and deletes X; concurrently, a client at replica 2 checks that X remains and deletes Y. Each transaction obeyed the rule locally, and together they left neither.

Mended outside

Put right afterwards (Compensation)Settled afterwards (Compensation)

Systems that cannot prevent Lost Update or Write Skew often let both visits complete while cut off and put things right afterwards, as a scholar who later finds an entry with no source restores one.Systems that cannot prevent Lost Update or Write Skew often let both transactions commit while partitioned and issue a compensating action afterwards.

Dodged by changing the rule

Numbers and counts kept differentlyIdentifiers and counters kept differently

A clash can often be avoided by changing the rule. If entry numbers need only be unique, not consecutive (1, 2, 3 …), each library puts its own number in front of its own count and needs no one else. And a count kept on a board with a column for each library, each adding only to its own, never reads and writes over at all.*A clash can often be avoided by changing the rule. If identifiers need only be globally unique, not sequential (1, 2, 3 …), each replica prefixes its own replica number and needs no coordination. And a counter kept as one entry per replica, merged by maximum, is never read and written over at all.*

Proof · that Lost Update and Write Skew cannot be prevented with high availability

rx(v) is a read of item x returning v, and wx(v) a write of v to x. Lost Update: T1 reads an item, T2 updates it, and T1 then writes from its original read. Write Skew: the same across several items bound by a constraint. Transactional availability: a transaction that reaches a replica for each of its items eventually commits, or aborts by its own choice. Claim. Neither anomaly can be prevented with high availability.

  1. This is §5.2.1. Lost Update: T1 reads an item, T2 updates the same item, and T1 writes based on its original read, losing T2's update. Take T1 : rx(100) wx(100 + 20 = 120) and T2 : rx(100) wx(100 + 30 = 130), submitted on opposite sides of a network partition.
  2. By transactional availability both must be allowed to commit. Whichever of 120 and 130 a replica then chooses, the state could not have arisen from a serial execution of T1 and T2, since a serial execution gives 150.
  3. To prevent it, one of the transactions must not commit. Each side's server could try to detect that another write occurred, but this requires knowing the version of the latest write to x, which reduces to a requirement for linearizability, provably at odds with high availability by Gilbert and Lynch's proof of the CAP theorem.
  4. Write Skew generalises Lost Update to several items: T1 : ry(0) wx(1) and T2 : rx(0) wy(1), with a constraint that only one of x and y may be 1. Run on opposite sides of a partition, both commit and the constraint is violated, though each would have preserved it in isolation; any prevention needs the same knowledge of the other side and is likewise unavailable.
  5. Hence Snapshot Isolation, Cursor Stability and consistent read (which require preventing Lost Update), and Repeatable Read and one-copy serializability (which require preventing both) are not achievable with high availability.∎
What readers ask for firstWhat clients ask for first

The latest versionThe latest version

No library that must always answer can promise that the version handed over is the latest (linearizability), nor even a looser bound such as no more than a day behind.Finally, no replica that must always answer can promise that the value returned is the latest version (linearizability), nor even a looser time bound such as no more than a day behind.

If couriers can be stopped for longer than the bound a library promises, a scholar at Library 1 can write a new version just as the stoppage begins; once the stoppage outlasts the bound, Library 2 must either stop answering, breaking availability, or hand over its old copy, breaking the bound. This is the impossibility met at the camps of Arche,* carried over to every bound on staleness.Why? Because if messages can be cut off for longer than whatever time bound the replica promises, a client at replica 1 can write a new version just as the partition begins, and once the partition outlasts the bound, replica 2 is forced either to stop answering (breaking availability) or to return its old version (breaking the recency bound). This is the exact CAP impossibility,* extended to every bounded-staleness guarantee.

Name a bound, then stop the couriers a new version is written at Library 1 just as they stopName a bound, then partition the network a new version is written at replica 1 just as they stop

Library 2 promises: no more thanReplica 2 promises: no more than
The couriers stay stopped forThe partition lasts

Proof · that no recency guarantee, including linearizability, is achievable with high availability

A recency guarantee bounds how out of date a read may be: linearizability (a read returns the last completed write), safe and regular register semantics, or any bound in time. High availability: every client that reaches a non-failing replica gets a response. Claim. No recency guarantee can be provided with high availability.

  1. This is §5.2.2. A recency guarantee bounds how out of date a read may be: linearizability (reads return the last completed write), safe and regular register semantics, and any bound such as "no more than five seconds out of date".
  2. Let a write complete at a replica on one side of a partition and let a client then read the item at a replica on the other side. The partition may last indefinitely, with no message crossing.
  3. By availability the reading replica must respond, and it can respond only from information it received before the partition began, which does not include the write. So the response is out of date by at least the time the partition has lasted.
  4. Since the partition can last longer than any fixed bound, no recency bound is enforceable. This is the argument of Gilbert and Lynch for the CAP theorem, applied to every recency guarantee.∎

What the libraries win by giving up the third shelf is speed, even on days when every courier is running. In the authors' benchmarks across continents, transactions that coordinated through one master, or waited on a majority of libraries, took 10 to 100 times longer than highly available transactions (HATs) answered locally. And of eighteen commercial databases surveyed, only three gave full serializability by default, and eight did not offer it at all; the rest already ran at weak isolation levels (Read Committed or weaker) that can be made highly available.What do the replicas win in exchange for giving up the third group? Speed, even when the network is healthy! In the authors' geo-distributed benchmarks across continents, transactions that coordinated through a single master or quorum took 10 to 100 times longer than Highly Available Transactions (HATs) answered locally. Better yet, surveying eighteen commercial databases revealed that only three gave serializability by default and eight did not offer it at all; the rest already ran at weak isolation levels (Read Committed or weaker) that can be made highly available.

The limits

What it does not say

The paper sorts transactional guarantees onto three clear shelves. Here are four things it does not claim.The paper sorts transactional guarantees into three clear groups. Here are four things it does not claim.

Is “answering alone” the only useful definition of availability?

No. It is deliberately the strictest one, asking every library that has not failed to answer whatever the stoppage. A library that needs to answer only in the connected majority of the coast, as the Chamber and the Tholos do, or only with high odds, as the coast's odds give, can make stronger third-shelf promises to the readers it serves.No, it is deliberately the strictest one (requiring 100% of non-failing replicas to answer under arbitrary partitions). A system that only needs to answer in the connected majority (as consensus protocols do), or only with high probability (like PBS), can provide stronger third-group guarantees to the clients it serves.

Are the proof-of-concept devices meant for production as-is?

Not always. Keeping a floor across all libraries stalls what can be shown whenever one library is slow. The paper's buffered design for Monotonic Atomic View (MAV), however, is practical, and gave high throughput and low delay in the authors' experiments.Not always. For instance, keeping a global stable version across all replicas can stall visibility whenever one replica is slow. The paper's buffered Monotonic Atomic View (MAV) design, however, is genuinely practical and achieved high throughput and low latency in the authors' experiments.

What happens when you combine several guarantees?

A combination of guarantees is only as available as its least available part: combining any first-shelf HAT guarantee with Read Your Writes makes the combination Sticky, and adding Prevent Lost Update makes it Unavailable. Across the combinations studied, the paper maps out 144 distinct consistency and isolation levels.A combination of guarantees is only as available as its least available part: combining any first-group HAT guarantee with Read Your Writes makes the combination Sticky, and adding Prevent Lost Update makes it Unavailable. Across the combinations studied, the paper maps out 144 distinct consistency and isolation levels.

Can every application live without the third shelf?Can every application live without the third group?

No. Some changes truly need Lost Update or Write Skew prevented. The lesson is to keep slow coordination across the coast for the few changes that need the third shelf, and run the rest at the speed of the reading room.No. Some operations genuinely require preventing Lost Update or Write Skew. The lesson of HATs, and of the CALM theorem*, is to reserve slow cross-system coordination for the few operations that truly need the third group, while running the rest at local speed.

A replica that must always answer can still hide unfinished writes, show a transaction's writes all together, and never go backwards.

It cannot prevent lost updates or write skew, or bound how stale a read is. Those need replicas to coordinate.

Setting Libraries That Agree in the End

The paper behind this book

Peter Bailis, Aaron Davidson, Alan Fekete, Ali Ghodsi, Joseph M. Hellerstein and Ion Stoica, Highly Available Transactions: Virtues and Limitations. Proceedings of the VLDB Endowment, Vol. 7, No. 3 (40th International Conference on Very Large Data Bases, Hangzhou, September 2014), 181–192. — A taxonomy of highly available, sticky available and unavailable isolation and consistency models, with proofs of unavailability and proof-of-concept algorithms.

The ideas, plainly.

Bailis and co-authors ask which of the guarantees that databases and distributed systems offer can be kept by a replica that must always answer, even when it is cut off from every other replica for as long as the cut lasts. They call such systems highly available, and with transactions, highly available transactions. They go through the known guarantees and sort them into those that can be kept, those that can be kept if each client stays with one replica, and those that cannot.

The first group includes read committed, which stops a client reading writes that are not finished, monotonic atomic view, which makes the writes of one transaction visible all together or not at all, repeatable reads within a transaction, and monotonic reads and writes and writes-follow-reads. The second adds read-your-writes, PRAM and causal consistency. Each is built by holding writes back from readers until it is safe to show them, never by making a reader wait.

The third group is made of the guarantees that need a replica to know about concurrent operations elsewhere: preventing lost update and write skew, which rules out snapshot isolation, repeatable read in its other senses and serializability, and any bound on how out of date a read may be. These are fundamental, not weaknesses of particular systems. The paper concludes that many applications can live with the first two groups, that some operations will need the third and should use it sparingly, and that high availability buys the lowest delay.

The paper has six authors, Peter Bailis, Aaron Davidson, Alan Fekete, Ali Ghodsi, Joseph M. Hellerstein and Ion Stoica, and all are credited here. Nobody in this telling is named; the librarians and readers are told apart by what they do.

In the paper, term by term
the reading room of a library; a reader's visitA server; a transaction, a group of operations over several items. §1, §4.
the couriers stoppedA network partition, indefinitely long. §2.1, §4.
answering alone, from one's own copyHigh availability: every client that reaches a non-failing server gets a response. §4.
a library that waits for most of the coast, or answers "probably"Not available: a majority-quorum system, or a response with high probability. §4, footnote 2.
a visit that finishes, or is withdrawn by the readerTransactional availability: commit or internal abort, never indefinite external abort. §4.2.
staying with one librarySticky availability; a client acting as a server itself. §4.1.
no half-made or abandoned correction shownRead Committed (Adya PL-2); no dirty reads (G1). §5.1.1.
every correction of a visit carries one tallyRead Uncommitted (PL-1): one timestamp per transaction, last-writer-wins; no G0. §5.1.1.
corrections bound under one cord; held back until all have arrivedMonotonic Atomic View (MAV): writes pending stable; item list and timestamp. §5.1.2.
the same answer twice in a visit; the same list twiceItem Cut Isolation; Predicate Cut Isolation (ANSI Repeatable Read, disambiguated). §5.1.1.
the floor of what every library holdsReading from a globally agreed lower bound on versions; multi-versioning. §5.1.1, §5.1.3.
never older than before; corrections shown in the order madeMonotonic reads; monotonic writes. §5.1.3.
an answer held for the entry it answersWrites follow reads. §5.1.3.
a reader finds their own correctionsRead your writes: needs stickiness. §5.1.3.
a visit read and written in order; questions before answers, tooPRAM; causal consistency (PL-2L), both sticky. §5.1.3.
the coast's libraries settle the same way in the endConvergence, by anti-entropy. §5.1.4.
two scholars each reading a count and writing it one higherLost Update; unavailable: it needs linearizability. §5.2.1.
two scholars each striking one of an entry's two sources, leaving noneWrite Skew; unavailable. §5.2.1.
"this is the latest version"; "no more than a day behind"Recency guarantees, linearizability, safe and regular semantics; unavailable. §5.2.2.
restoring a source afterwardsCompensation: moving non-monotonicity to the real world. §6.2.
unique entry numbers; next-in-sequence numbersUnique IDs by client identifier and timestamp; sequential IDs need preventing Lost Update. §6.2.
a count kept with a column for each libraryCommutative updates in place of register semantics: the paper notes its Lost Update example could be made serializable this way, though the problem persists in general; TPC-C's New-Order restocks inventory instead. §5.3, note 4; §6.2.
a store routed through one master, ten to a hundred times slowerMeasured latency of mastered operations against HAT operations. §6.3.
a combination is as available as its least available partThe partial order of HAT, sticky and unavailable models. §5.3, Figure 2.