What is the TrueTime API in Google's Spanner?

三世轮回 提交于 2019-12-05 11:37:23

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!