-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Check partition placement constraints when local transactions read data #21426
Comments
Maybe We can check the placement constraint in the We can check the |
Some other operators are missed. AFAIK, |
How about both checking the constraint in the WDYT? @breeswish @XuHuaiyu |
After discussion with @djshow832 @XuHuaiyu , the constraint checking will be placed into |
Background
Issue #20827 proposes to forbid local transactions to write partitions placed at other DC. It intends to avoid lost updates because the local timestamps from 2 DC are not monotonically increasing.
In that proposal, local transactions are allowed to read partitions placed at other DC. However, this may violate linearizability. So this issue proposes to also check placement constraints when reading partitions.
Problem
Consider such a scenario:
A and B stand for one TiDB instance from two data centers. The partition
p0
is placed in the data center B.p0
and commits. The commit ts of Txn1 is 100.p0
. The start ts of Txn2 is 50. Even if Txn2 starts after Txn1 commits, but the local TSO is not monotonically increasing, so the start ts of Txn2 may be less than the commit ts of Txn1.Solutions
To resolve this problem, there are 2 solutions:
There are 2 methods to implement solution 2:
Method 1 looks very inefficient because it checks placement constraints too many times.
Method 3 seems fine but it's not. Since Txn2 is a read-only transaction, the client (or the application) might not commit it explicitly.
For example:
Implementations
// TODO
The text was updated successfully, but these errors were encountered: