What is the TrueTime API in Google's Spanner?
Asked Answered
N

1

13

I tried to read the document multiple times but failed to understand it. Can someone explain it in layman's terms?

Neoteny answered 27/10, 2016 at 0:3 Comment(1)
Take a look at: #18385383Barnyard
C
25

TrueTime is an API available at Google that directly exposes clock uncertainty.

Comparing to standard datetime libraries, instead of a particular timestamp, TrueTime's now() function returns an interval of time [earliest, latest].

It also provides two functions:

  • after(t) returns true if t has definitely passed. E.g. t < now().earliest.
  • before(t) returns true if t has definitely not arrived, or t > now().latest.

What's impressive, is that the implementation of now() returns intervals with generally small uncertainty.

Spanner uses TrueTime API to assign a commit timestamps to transactions in the way that it satisfies external consistency: if a transaction T1 commits before another transaction T2 starts, then T1’s commit timestamp is smaller than T2’s.

More in the Spanner paper http://static.googleusercontent.com/media/research.google.com/en//archive/spanner-osdi2012.pdf

Cappella answered 27/10, 2016 at 18:44 Comment(1)
So for a given time t, is possible that on server A before(t) is true and on server B that is false?Arica

© 2022 - 2024 — McMap. All rights reserved.