user1091344
user1091344

Reputation: 740

Spanner's Read-Only Transaction

I do understand Spanner's read-only transaction in one paxos group.

But how does the read-only transaction over more than one paxos group work? The paper says that it uses TT.now().latest as timestamp which then performs a snapshot read with the given timestamp. But why does this work?

In each replica, there is a safe time. The safe time is the timestamp of the last write transaction within the replica. The replica is up to date, if asked timestamp <= safe time.

The paper also says that the snapshot read with the given timestamp (second phase of the read-only transaction) may need to wait until the replicas are up to date. What happens, if after the read transaction, there will never occur any write transaction? Then the safe time will never be updated and the read transaction will be blocked forever?

Upvotes: 2

Views: 1439

Answers (2)

Dominic Preuss
Dominic Preuss

Reputation: 697

Spanner is now available a service on Google Cloud Platform.

Here are the docs on how the read-only transactions work:

https://cloud.google.com/spanner/docs/transactions#read-only_transactions

==

A Cloud Spanner read-only transaction executes a set of reads at a single logical point in time, both from the perspective of the read-only transaction itself and from the perspective of other readers and writers to the Cloud Spanner database. This means that read-only transactions always observe a consistent state of the database at a chosen point in the transaction history.

==

Upvotes: 1

lambda
lambda

Reputation: 635

AFAICT, the point is that, if a process sees TT.now().latest has passed, all other process will never get that timestamp, thus any future write transaction will have commit time (safe time) greater than that. So the process performing the snapshot read only need to wait until that timestamp passes.

Upvotes: 2

Related Questions