Stale read for rawkv with read ts
Signed-off-by: iosmanthus [email protected]
This pull request is based on the https://github.com/tikv/rfcs/pull/80.
There is a special case that user may choose availability rather than consistency. So client is OK to read with any ts, that is just return what the replica has currently. In this RFC, it seems keys with larger ts may be skipped during read.
There is a special case that user may choose availability rather than consistency. So client is OK to read with any ts, that is just return what the replica has currently. In this RFC, it seems keys with larger ts may be skipped during read.
This RFC doesn't depend on the keys' timestamp, the underlying storage could have no information about the timestamp. The safe_ts is like the (approximate) timestamp of the leader that writes the key. The read_ts tends to be checked against the safe_ts to guarantee the replicas have already been synced with those writes that happened around safe_ts. To read any data, we could specify the read_ts to 0, and then any replicas with safe_ts > 0 could handle the request.
I'm OK with 0 timestamp. Currently, txn stale read consider ts 0 an error. And client (like TiDB) may actually send ts 0 by mistake. This RFC should state clear what 0 means in rawkv and implementation should not break compatibility.