17

In Spanner, TrueTime & The CAP Theorem, Eric Brewer writes:

One subtle thing about Spanner is that it gets serializability from locks, but it gets external consistency (similar to linearizability) from TrueTime [emphasis added].

What is the definition of external consistency, and how does it differ from linearizability?

Lorin Hochstein
  • 281
  • 2
  • 8

5 Answers5

13

External consistency doesn't have a fixed meaning. In this context, it has the meaning appearing in the very next sentence in the document:

For any two transactions, $T_1$ and $T_2$ (even if on opposite sides of the globe): if $T_2$ starts to commit after $T_1$ finishes committing, then the timestamp for $T_2$ is greater than the timestamp for $T_1$.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
3

There is a distinction between external consistency and strict serializability. I wrote a comment on it here https://stackoverflow.com/questions/60365103/differences-between-strict-serializable-and-external-consistency/65853495#65853495.

The difference is that strict serializability imposes no order on concurrent transactions, whereas external consistency does (the order in which they commit).

aaw
  • 31
  • 1
2

You can think about external consistency from transactions (Tx) isolation and order point of view. In Tx isolation speak the external consistency is equivalent to the strict serializable isolation, where 'strict' is the real-time constraint part (as in linearizability).

That again all means that to a system client observable Tx side effects are equivalent to a system, where all Tx take place in isolation without any concurrency and where their real-time ordering, as seen by the client, is preserved. More importantly this same ordering is seen by any other unrelated client.

Read more about the distinction at this blog.

Oleg
  • 21
  • 1
1

When mentioning "external consistency", Brewer references B. Liskov. Practical Uses of Synchronized Clocks in Distributed Systems. ACM Principles of Distributed Computing (PODC). Montreal, Canada, August 1991.

Liskov, in term, references Gifford D.K. Information Storage in a Decentralized Computer System. Technical Report CSL-81-8, Xerox Corporation, March, 1983

Here's how Gifford defines external consistency:

External consistency guarantees that a transaction will always receive current information. Using the concepts we have just introduced, we can provide a formal definition of external consistency. The actual time order in which transactions complete defines a unique serial schedule. This serial schedule is called the external schedule. A system is said to provide external consistency if it guarantees that the schedule it will use to process a set of transactions is equivalent to its external schedule.

As @Oleg mentions, this sounds like strict serializability.

Lorin Hochstein
  • 281
  • 2
  • 8
0

To my limited understanding there is not much differency bw external consistency and linearizability:

Definition of linearizability [1] is

  1. The extended list can be re-expressed as a sequential history (is serializable).
  2. That sequential history is a subset of the original unextended list.

And 2. means:

If an operation op1 completes (gets a response) before op2 begins (invokes), then op1 precedes op2 in history.

And that is what exactly Google calls external consistency [2]:

For any two transactions, T1 and T2 (even if on opposite sides of the globe): if T2 starts to commit after T1 finishes committing, then the timestamp for T2 is greater than the timestamp for T1.

Replace op with tx, response with commit and here we are. They seem to be essentially the same.

[1] https://en.wikipedia.org/wiki/Linearizability
[2] https://storage.googleapis.com/pub-tools-public-publication-data/pdf/45855.pdf