Search code examples
distributed-transactionsgoogle-cloud-spanner

What assigns timestamps to read-only transactions in Spanner?


The Spanner paper makes it clear that commit timestamps are chosen for read-write transactions by the coordinator leader. However, I'm not sure of where the timestamps are chosen for read-only transactions.

The documentation here says:

API Layer will pick the read timestamp by using the current TrueTime.

But where is that API layer situated? Does that refer to the location proxy that the paper says clients use to locate the relevant spanservers? The paper says it uses TT.now().latest but I can't tell where that gets invoked.

I had assumed that the timestamp could be chosen by any of the Paxos leaders involved in the multi-site read, but apparently not. Can someone please help clarify?


Solution

  • But where is that API layer situated? Does that refer to the location proxy that the paper says clients use to locate the relevant spanservers?

    That's correct, it's in the API proxy.

    I had assumed that the timestamp could be chosen by any of the Paxos leaders involved in the multi-site read, but apparently not.

    To negotiate a timestamp, strong read requests must contact the Paxos leader for each Spanner group involved in that read.