-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support timestamp bounded read-only transactions on data replicas #19817
Comments
Relates to #18672 I think it's useful to have this as part of a START TRANSACTION READ ONLY WITH TIMESTAMP BOUND MAX STALENESS follower_read_timestamp(); |
The staleness maybe is not acceptable to the applications. Is there any use case of this behavior? |
This feature request can be regarded as a subtask of #18033 |
Feature Request
Is your feature request related to a problem? Please describe:
There is a scenario that in a multi-region application, mostly all the database transactions are read-only, only some of them are read-write and write-only transactions. Applications can tolerate high read-write and write-only transaction durations. But the throughout of read-only transactions on each Region should be maximized, the QPS should be as high as possible, while the latency should be as low as possible. For read-only transactions, it's OK for the applications that a timestamp bounded stale data is returned.
A solution for these applications is to gather all the leader replicas to one Region, deploy learner replicas on other Regions to maximize the read throughput.
TiDB has supported Follower Read since release 4.0.0. At present, it has these limitations in this scenario:
It only provides strong-read to guarantee to see all the effects of all transactions that have committed before the start of the read. As mentioned in the document: "To achieve strongly consistent reads, the follower node currently needs to request the current execution progress from the leader node (that is ReadIndex), which causes an additional network request overhead.". So the read latency and read QPS can not be maximized due to the cross-region network round-trip which is brought by the
ReadIndex
operation.Only the follower replica can provide reads. In order to support more Regions or AZs, we need to add more follower replicas, which influences the raft quorum, introduces more cross-region network round-trips on write transactions.
Describe the feature you'd like:
Support read-only transactions on follower and learner replicas with a bounded timestamp.
Like Cloud Spanner Timestamp bounds, there are three kinds of stale read:
ReadIndex
can be optimized if the currentBTW, I found we can utilize the syntax added in pingcap/parser#610 to support time travel read-only queries.
But it's better to support these modifiers to the
begin
statements as well.Describe alternatives you've considered:
N/A
Teachability, Documentation, Adoption, Migration Strategy:
N/A
The text was updated successfully, but these errors were encountered: